[WORD] Execute MailMerge in VB6
I am trying to use VB6 to open a MailMerge document.
This Word document is connected to a Text file as datasource.
When I try to open c:\source\letter1.doc, a message box will pop up:
Quote:
Opening this document will run the following SQL command:
SELECT * FROM c:\source\LETTER1.TXT
Data from your database will be placed in the document. Do you want to continue?
[ Show Help >> ]
[ Yes ] [ No ]
I want to use VB to execute the mailmerge and generate a new file name mail.doc and show in print preview mode.
Please help. :cry:
Re: [WORD] Execute MailMerge in VB6
vb Code:
yourwrdobj.displayalerts = false
set objmrgdoc = yourwrdobj.documents.open(yourfile)
is this what you want to do?
Re: [WORD] Execute MailMerge in VB6
Set WordDoc = WordApp.Documents.Open(strWordFile)
The above code will only open the file as normal Word document, not as Letter (MailMerge).
How can I execute the document so the fields are shown using VB?