ACC95: Running Word Mail Merge from Access Using OLE AutomationLast reviewed: August 28, 1997Article ID: Q154571 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article demonstrates how to use OLE Automation to run a Microsoft Word for Windows 95, version 7.0 mail merge. Microsoft Word 97 uses the Visual Basic for Applications object model for Automation code. For an example of how to run a mail merge using Microsoft Access 7.0 or 97 with Microsoft Word 97, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q159328 TITLE : ACC: Use Automation to Run Word 97 Mail Merge from AccessThis 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 INFORMATIONThrough OLE Automation, it is possible to set up and perform a mail merge in a Microsoft Word document using OLE Automation in Microsoft Access. This example uses the WordBasic MailMergeOpenDataSource and MailMerge statements.
Example: Mail Merge a Microsoft Access Query with a Word DocumentThe following example opens a Word document called Mymerge.doc and through an OLE object variable, runs the WordBasic MailMergeOpenDataSource statement, which turns the opened document into the main document for the mail merge process. The following code example assumes that a document, C:\Mymerge.doc, exists. To run this code:
REFERENCESFor information about OLE Automation, search on the phrase "OLE Automation" and choose the "Accessing Word for OLE Automation" topic in the Microsoft Word Help file. For information about the WordBasic commands used in this code, search on the phrases "MailMergeOpenDataSource statement" and "MailMerge statement." (To do so, you must have the WordBasic help file, Wrdbasic.hlp, installed.) For more information about using OLE Automation between Microsoft Access and Word, search on the phrase "Create a Word Document using OLE Automation," and then "CreateObject function" using the Microsoft Access 7.0 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 kbole IntpOleA Technology : kbole Version : 7.0 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |