Go Premium for a chance to win a PS4. Enter to Win


Populating a Microsoft Word Document from Microsoft Access VBA

Posted on 2017-09-12
Low Priority
Last Modified: 2017-10-01
I have an Microsoft Access Application that generates a contract using Microsoft Access reports.  I would like to setup contract templates in Microsoft Word and then use Microsoft Access VBA to export data to the contract and the Word document needs to be locked.  

I know how to code in VBA to export data to Excel, but I have never done it to Microsoft Word.  Also, I have never setup Word Document templates with fields.  

Can someone help point me in the right direction?  

Question by:Marilyn
  • 2
LVL 40

Expert Comment

ID: 42291395
Try to consider other approach - create word merge document with the source - Access table with prepared data. You can open nesessary template from Access

Author Comment

ID: 42291400
Ok, thanks.  I'm going to investigate setting up a word merge document.
LVL 40

Accepted Solution

PatHartman earned 1000 total points (awarded by participants)
ID: 42291507
Mail Merge is too limiting.  I've attached a database that shows a basic example of how to do this along with two letters.  On the sample form use the button for the path field to locate the document you want to fill.  For simplicity, all the fields you are filling are hard-coded but this is easy enough to do with tables if you want something more sophisticated.  I have one app used by an insurance company that fills thousands of different documents.  And NO CODING is required to create a new document and link it in to the app.  In fact, the users do it themselves.

Sorry - it's too big to upload.  Please send me a PM with your email and I will send it to you.  Do NOT post your email in this thread.
LVL 40

Expert Comment

ID: 42314626
I sent the sample via email since it was too large to post on the EE site.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question