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

MS Word Mailmerge Problem

Status
Not open for further replies.

girls3dog1

Programmer
Nov 22, 2002
30
US
I have a word template file with a datasource defined with it. I open the file in VBA with ...Document.Open("filename") and the file opens with out the datasource. Is there a way to have the template file open with datasource attached?



Here's snippet of my code:

//Open document and merge new data and save

ls_document_name = "c:\database\test3.doc"

ole_Word.Documents.Open(ls_document_name)

ole_Word.ActiveDocument.MailMerge

ole_Word.ActiveDocument.MailMerge.Destination=1

ole_Word.ActiveDocument.MailMerge.Execute(False)
 
Please be clear with the word "template".

Are you using a real template (ie. a DOT file) and cloning it properly to make a .DOC file? Or are you opening the .DOT file? Or are you using a .DOC file with a data source, and calling it a template?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top