Word Automation and Form Letters

N

Nick Olsen

Using Word 2007 and Visual Studio 2008

I have an application that allows the user to create a template with various
fields that can be replaced with data from a database. It is classic form
letter functionality. The user creates something like the following:

Dear [FIRST_NAME] [LAST_NAME],

Thank you for chosing [COMPANY_NAME] as you technological support...

The user then saves the file and if they want to send this out to 100
customers, the various fields will be replaced with the inidcated item.

I started going about this using Word automation. I opened one blank
document and opened the template. In the template I did a replace all for
each of the fields [FIRST_NAME] etc. I then copied the entire document from
the tempalate (which now had the corrent values not [FIRST_NAME], and pasted
it into the blank document.

I was originally closing the template and reopening it as the last time it
was open it replaced the [FIRST_NAME] with the first name of the first
customer and going back to the template I wouldn't be able to know where the
first name of the second customer should go.

So I thought maybe I could open and close the template each time without
saving the changes. That would work but would also take forever, opening and
closing the same document 300 times. Not a good strategy.

I read something about adding bookmards rather than just straight text? I'm
not sure if that is a good route. I'm sure this has been done by a million
people. What is the best way to go about it?

Thanks

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top