HOWTO: Save an Embedded Word Document in Visual BasicLast reviewed: September 29, 1997Article ID: Q112440 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Word for Windows, version 6.0
SUMMARYWord version 6.0 for Windows disables the ability to do a FileSaveAs while an object is being edited in an OLE container. While these methods may not be enabled, it is possible to work around this limitation in code. This article explains how.
MORE INFORMATIONCommands that are part of the workspace are the responsibility of the top container (the Visual Basic application). That is, the application is responsible for the organization of windows, file level operations, and how edits are ultimately saved. The top container must supply a single File menu that contains file level commands such as Open, Close, Save, and Print. If the object is an opened object server application, the commands in its File menu are modified to show containership (Close & Return to <container doc>, Exit & Return to <container doc>). A well-behaved OLE server will not allow workspace commands to be executed. This is why they are disabled. To work around the problem, edit the object in the server application -- without using in-place editing. In the server, you'll find that the workspace commands are enabled. Therefore edit the object in the server and use OLE Automation to control the server to execute the Workspace commands.
Step-by-Step ExampleThe following example uses an OLE2 control called OLE1, which contains an embedded Word version 6.0 document and a CommonDialog control called CMDialog1. To make the code generic, the OLE1 control is passed to the WordFileSave subroutine.
Keywords : IAPOLE PrgCtrlsCus vbwin GnrlVb kbprg kbfasttip Technology : kbole kbvba Version : WINDOWS:3.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |