This article was previously published under Q292078
This article has been archived. It is offered "as is" and will no longer be updated.
When you use a macro to open a new document while Microsoft Word is minimized, the new document is not minimized as expected. Instead, the document opens in the restored state.
For example, you can create a macro to run a mail-merge operation to create and then to print documents with Word minimized so that you can continue working in your current program. However, when the new documents are created, Word becomes visible in the restored state.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information about how to use the sample code in this article, click the following article number to view the article in the Microsoft Knowledge Base:
290140 How to run the sample code for the Office XP programs from Knowledge Base articles
Use the Application.Visible method to hide Word and then make it visible again. To hide Word when you create a new document, follow these steps:
In Microsoft Word 2002 and in Microsoft Office Word 2003, point to Macro on the Tools menu, and then click Visual Basic Editor.
In Microsoft Office Word 2007, click Visual Basic in the Code group on the Developer tab.
On the Insert menu, click Module.
In the module window, type the following code.
Sub HideWord() ' ' HideWord Macro ' ' Hide Word while the new document is being created. Application.Visible = False ' Create a new blank document Application.Documents.AddEnd Sub
On the Run menu, click Run Sub/UserForm.
NoteThe new document is created without Word becoming visible.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.