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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailmerge automation with Word 2003

Status
Not open for further replies.

RazorbackHog

Programmer
Oct 28, 2000
183
US
Hi,

I have an automated mailmerge app in VFP9 and all is working fine except that I need to know how to select a document and tell word to save it. Here's my scenario:
I have about 8 letters in different languages to merge, so I am looping through creating a data set for each language then doing a mailmerge on that data set sending it to a new document. At this point I have the letter document open AND the new document containing the merged letters. How do I tell word to save the merged letters with a specified file name then close the opened merge document so I can move to the next dataset/form letter?

Thanks.
 
Right after the merge is performed, the newly merged document is ActiveDocument, so you can do this to get a reference to the document:

oMergeResult = oWord.ActiveDocument

Then, you can do whatever you want with the document:

oMergeResult.Save(cMyFileName)
oMergeResult.Close()

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top