Access vba open word document mail merge


Open Word. Alt + F11 to open the Visual Basic Editor. Insert-Module. Paste the code there. Close the VBE (Alt + Q or press the X in the top-right corner). Test the code: Create a Mail Merge document with more than one data record. Tools | Macro | Macros, and double-click AllSectionsToSubDoc. Sample File: Mail Merge.zip 5.21KB Opens or switches to the mail merge data source. Syntax. expression. EditDataSource. expression Required. A variable that represents a 'MailMerge' object. Remarks. If the data source is a Microsoft Word document, this method opens the data source (or activates the data source if it is already open). Re: VBA Access/Word Mailmerge. Well, I'm running the Word Mailmerge from a vba module in Access. That means that this access file will be open whenever the mailmerge is going to be run. It looks like if you have more than one access file open while the mailmerge is running it wont quit out of the access file after the mailmerge runs. Word and other Office XP applications use the Office DataSource Object (ODSO) for OLEDB access to external data sources. ODSO is the only mechanism by which Word can access data by using OLEDB for a mail merge. ODSO requires that the Name argument for OpenDataSource be either a complete path to a database or a complete path to a valid ODC file.