WD2000: PRB: New Document Remains in Normal WindowState When Application is Minimized

ID: Q235877


The information in this article applies to:
  • Microsoft Word 2000
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
  • Microsoft Visual Basic for Applications versions 5.0, 6.0


SYMPTOMS

When you automate Microsoft Word 2000 with code such as the following:


    Set oApp = CreateObject("Word.Application")
    oApp.Visible = True
    oApp.Documents.Add
    oApp.WindowState = wdWindowStateMinimize
    oApp.Documents.Add 
the Word application is minimized but the new document window is in a normal window state. You expect that the new document window would also be minimized.


CAUSE

Word 2000 is now a Single Document Interface Application. So, whenever a new document is opened in Word 2000, it is opened in a separate window with the default WindowState. This occurs only if a document is already open in the running instance of Microsoft Word.


WORKAROUND

To work around this behavior, set the Visible property of Word to False instead of minimizing it. You do not see the new document when it is created. The code would now be:


    Set oApp = CreateObject("Word.Application")
    oApp.Visible = True
    oApp.Documents.Add
    oApp.WindowState = wdWindowStateMinimize
    oApp.Visible = False
    oApp.Documents.Add 
Alternately, depending on the application requirements, you can stay with the default Visible property instead of changing it to False later.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Word 2000.


REFERENCES

For more information on Office Automation, please visit the Microsoft Office Development support site at:

http://support.microsoft.com/support/officedev
 

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Harsha Bennur, Microsoft Corporation

Additional query words:

Keywords : kbAutomation KbVBA wd2000 kbWord kbGrpDSO kbDSupport
Version : WINDOWS:2000,5.0,6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: August 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.