Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word 2010 - Replacing specific variables/text

Status
Not open for further replies.

DotNetNewbie

Programmer
Mar 3, 2004
344
GB
Hey,

I have been asked to improve the efficiency of our contracts department. They have a standard document with a number of key pieces of information that need to be changed depending on the client.

Currently the document relies on an excel spreadsheet as a data course and they then run a mail merge to generate the documentation. Though this works I do not think it is the most efficient method.

What I would ideally like is on the first page have a table containing all the pieces of information that need to be changed and a macro/button that will sweet through the document and replace the information at the appropriate points.

I know this can be done via a macro and have had some success in doing this, however I believe there may be a more efficient way of doing this through VBA code and variables. Though I have experience in VB code I have little when it comes to word.

Any advice most welcome.

.net



 

I am sure you will find some better ways to do this, but if that was me, I would set up a little data base (Access would do just fine) with a couple of tables where you could keep all the information you need for your letters, including addresses, and any other information needed for your letters.

Then in Word I would set up a template (or templates) :

Dear [blue]Susie[/blue],
On our last conversation on [blue]Oct. 15, 2012[/blue] when you talked to [blue]Joe Brown[/blue] it has been decided to [blue]do whatever[/blue].

All the [blue]BLUE[/blue] parts would be bookmarks which you can easily populate with the data from your (Access) data base for the person you want to create the letter to.

Unless you have different needs.

Have fun.

---- Andy
 
If you want to do it with VBA than what you need to use are Document Variable Fields as your place holders.

However, effectively you are just copying the Mailmerge process.

I'd recommend that you just stick with Mailmerge. I suspect that it is possible to use VBA to automate Mailmerge to some degree if you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top