Word Automation Sample (1 Viewer)

Status
Not open for further replies.

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:36
Joined
Feb 19, 2002
Messages
42,981
This database presents an example of using VBA to fill bookmarked fields in a Word document. The Database is A2003 format. However, the only version of Word installed on my PC is W2007 so before using the example, you may need to open any code module and change the Word reference to whatever version you are using. The code will work with earlier versions of Word.

There is a single doument which for the sake of expediency in the example, has a hard-coded reference. You will most likely need something else.

The example also shows two ways to accumulate child records, One presents the data as a comma separated list and the other separates the columns with tabs and turns the glob into a table to which it then applies formatting. I left several formatting options in the code as comments.

I have started adding agreements to my samples. You are welcome to copy forms and code for your own use but you may not sell the sample database. I encourage you to share the sample with others but please do so without modifying it.

This app has not been tested on any PC but my own so if you have problems with it this week please post them in one of the forum sections and also send me a PM to make sure I see the issue.

I added a newer version and the word documents it uses. Feel free to make your own but you will need to modify the code if you want to add additional bookmarks since this sample is all hard coded.
 

Attachments

  • SampleWordAutomation.zip
    96.9 KB · Views: 3,442
  • SampleLettersOnly.zip
    33.7 KB · Views: 479
  • SampleWordAutomation_20210314.zip
    306.1 KB · Views: 530
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:36
Joined
Feb 19, 2002
Messages
42,981
I made some fixes to the tool. I've included the sample letters again for convenience.
 

Attachments

  • SampleLettersOnly.zip
    33.7 KB · Views: 171
  • SampleWordAutomation_20221120.zip
    273.9 KB · Views: 197
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom