Microsoft KB Archive/292078

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

Article ID: 292078

Article Last Modified on 12/19/2006

-

APPLIES TO


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

-



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. 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.



WORKAROUND
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.Add

End Sub  On the Run menu, click Run Sub/UserForm.

NoteThe new document is created without Word becoming visible.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Additional query words: VBE VBA WD2002 WD2003 WD2007

Keywords: kbexpertisebeginner kbbug kbnofix KB292078

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.