|
-
Jul 21st, 2008, 03:18 PM
#1
Thread Starter
Junior Member
[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:
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.
Last edited by Aeric; Jul 21st, 2008 at 03:24 PM.
Reason: update link
-
Jul 22nd, 2008, 06:03 AM
#2
Re: [WORD] Execute MailMerge in VB6
vb Code:
yourwrdobj.displayalerts = false
set objmrgdoc = yourwrdobj.documents.open(yourfile)
is this what you want to do?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 22nd, 2008, 12:25 PM
#3
Thread Starter
Junior Member
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|