ACC95: Using MS Word's FileClose/DocClose Statements in OLELast reviewed: August 29, 1997Article ID: Q156226 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. The WordBasic FileClose and DocClose statements unexpectedly close Microsoft Word when used through OLE automation. This article assumes that you are familiar with Visual Basic for Applications, Word Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access for Windows 95" manual.
CAUSEThe FileClose and DocClose statements close Microsoft Word unexpectedly if the following conditions are true:
RESOLUTIONUse either of the following two methods to work around this behavior.
Method 1: Make Microsoft Word Visible Before the FileClose StatementThis method uses the AppShow statement to make Microsoft Word visible before using the FileClose/DocClose statement. The AppShow statement is a Microsoft WordBasic statement that can be issued through OLE automation to make Microsoft Word visible.
Method 2: Create the Word Object Based on the Word.Document ClassThis method uses two OLE automation objects. The first object is created using the Word.Document class. The second object is created off the Application.WordBasic class that is derived from the first object.
MORE INFORMATIONMicrosoft WordBasic uses the FileClose statement to close the currently active document and all associated document windows, and uses the DocClose statement to close only the currently active document window in Microsoft Word. When either of these statements is issued from an OLE Automation controlling application, such as Microsoft Access or Microsoft Excel, Microsoft Word is closed unexpectedly.
Steps to Reproduce Behavior
REFERENCESFor more information about the FileClose and DocClose statements, search for "FileClose statement" and "DocClose statement" using the Microsoft Word for Windows 95 Help Index. For more information about creating objects with OLE Automation, search on the phrase "Create an object with OLE Automation," and then "CreateObject Function" or "Using Microsoft Access as an OLE Automation Controller" using the Microsoft Access for Windows 95 Answer Wizard. Microsoft Access, "Building Applications with Microsoft Access for Windows 95," version 7.0, Chapter 11, "Communicating with Other Applications," pages 262-290.
Keywords : AutoGnrl kbinterop kbole IntpOleA Technology : kbole Version : 7.0 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : kbcode |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |