A new document opens in the restored state when you use a macro to open the new document while Word is minimized

Support for Office 2003 has ended

Microsoft ended support for Office 2003 on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

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:
  1. 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.
  2. On the Insert menu, click Module.
  3. 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					
  4. 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.
VBE VBA WD2002 WD2003 WD2007

Article ID: 292078 - Last Review: 02/27/2014 21:07:40 - Revision: 3.2

Microsoft Office Word 2007, Microsoft Office Word 2003, Microsoft Word 2002 Standard Edition

  • kbnosurvey kbarchive kbexpertisebeginner kbbug kbnofix KB292078