Periodically Updating Word Templates with a VBA Macro

gtgole

New Member
Joined
Apr 8, 2014
Messages
3
Hi,

I'm hoping that someone can suggest a solution to the following problem:

I have a series of letter templates in Word (around 70 or so), that largely stay the same, but have certain fields that need to be regularly updated. My current process involves copy and pasting the folder containing all of the templates to a new location, and then going into the templates one by one and updating the relevant fields. I feel there must be a way to automate the process using <acronym title="visual basic for applications">VBA</acronym> (although if anyone has a suggestion for a different means of automation, I'm all ears).

Many of the fields that need to be updated have multiple instances throughout one or more of the templates.
I set up an Excel spreadsheet with a list of all of the fields that ever need to be updated in the templates. As a test, I went through one of the templates and set the initial instance of each field to be updated as a Bookmark. I then replaced all subsequent instances of each field to be updated as Cross-references to the relevant Bookmark. I attempted to write a macro in the Excel workbook to open the relevant Word template, set each of the Bookmarks to the corresponding value from the Excel worksheet, and then "Update Field" for all Cross-references in the document, so that all updates to the Bookmarked fields would flow through to the other instances of those fields in the document. I was able to get as far as opening the appropriate Word template through <acronym title="visual basic for applications">VBA</acronym>, but was not able to update the Bookmarks. Is this possible using <acronym title="visual basic for applications">VBA</acronym>?

Thanks so much for your help! :)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,216,160
Messages
6,129,215
Members
449,494
Latest member
pmantey13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top