WD2002: New Document Created by Macro While Word Is Minimized Opens in Restored State (292078)



The information in this article applies to:

  • Microsoft Word 2002

This article was previously published under Q292078

SYMPTOMS

When you use a macro to open a new document while Microsoft Word is minimized, the new document is not minimized as expected, but instead opens in the restored state.

For example, you can create a macro to run a mail-merge operation to create and then 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.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

290140 OFFXP: How to Run Sample Code 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. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  2. On the Insert menu, click Module.
  3. In the module window, type or paste 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.Add
    
    End Sub
    					
  4. On the Run menu, click Run Sub/UserForm.
The new document is created without Word becoming visible.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kbnofix KB292078