ACC95: Create and Date Stamp a Word Document Using OLE AutomatioLast reviewed: August 28, 1997Article ID: Q154567 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article demonstrates how to use OLE Automation to create a Microsoft Word document and add a date stamp. This article assumes that you are familiar with Visual Basic for Applications 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.
MORE INFORMATION
Example - Create and Date Stamp a Microsoft Word documentThe following example creates a new Microsoft Word document, inserts some text and formats it, and then inserts a text date stamp. To run this code:
?CreateDoc()NOTE: In both examples, when the OLE Automation object goes out of scope, the instance of Microsoft Word is unloaded unless the object was created from a previous instance (already opened). It is possible to set the object to a global variable so that it does not lose scope until the application is closed.
REFERENCESFor information about OLE Automation, in the Microsoft Word for Windows help file (you must have the WordBasic help file, WRDBASIC.HLP installed), search on "OLE Automation" and choose the "Accessing Word for OLE Automation" topic. For information about the WordBasic commands used in this code search on "Insert statement," "FormatFont statement," "FileNewDefault statement," and "InsertDateTime statement." For more information about using OLE Automation between Microsoft Access and Microsoft Word, search on the phrase "Create a Word Document using OLE Automation," and then "CreateObject function" using the Microsoft Access for Windows 95 Answer Wizard. For more examples of OLE Automation between Microsoft Access and Microsoft Graph, see the OLE Automation Help File available on the World Wide Web at www.microsoft.com. To locate the file, on the Microsoft Home page, click Support. On the next page, click "Search the Knowledge Base." In box 1, select Access. In box 3, type Q148124, and then click Go! Keywords : AutoGnrl kbinterop IntpOleA Technology : kbole Version : 7.0 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |