WD2000: ActiveWindow.Visible Property Causes Word to Appear to Stop Responding

ID: Q220419


The information in this article applies to:
  • Microsoft Word 2000


SYMPTOMS

When you manipulate the Visible property of the Visual Basic for Applications ActiveWindow property to hide a document, as in ActiveWindow.Visible = False, Word appears to stop responding when you close the document.

For example, the following procedure demonstrates this behavior:


Sub HideDoc()
    Documents.Add                              ' Add new document.
    ActiveWindow.Visible = False               ' Hide document.
    Selection.TypeText "This is a document."   ' Insert text.
    ActiveWindow.Visible = True                ' Show document.
End Sub 
After running the above procedure, if you perform the following steps:
  1. On the File menu, click Close.


  2. Click No to the Save Changes prompt.



You cannot perform any further actions in Word.


CAUSE

Word is in a state in which the toolbars have not been properly activated.


RESOLUTION

To work around the problem of Word appearing to stop responding, start another instance of Word. You can then perform further actions in Word.

To resolve the problem of setting the Visible property of the ActiveWindow, causing Word to appear to stop responding, use one of the following sample procedures as a substitute:

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 Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/


Sub HideDoc1()
    Dim oDoc As Document
    Set oDoc = Documents.Add                      ' Create new document.
    With oDoc.ActiveWindow
        .Visible = False                          ' Hide the document.
        .Selection.TypeText "This is a document." ' Insert text.
        .Visible = True                           ' Show the document.
    End With
End Sub 
-or-

Sub HideDoc2()
    Documents.Add                                 ' Create new document.
    With ActiveWindow
        .Visible = False                          ' Hide the document.
        .Selection.TypeText "This is a document." ' Insert text.
        .Visible = True                           ' Show the document.
    End With
End Sub 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

Additional query words: vba

Keywords : kbdta wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


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