Hi,
I have set up a mail merge document in MS Word I'll call MyTemplate.doc I
run Mail Merge to merge with a text file called MyData.txt.
I'm using VB to generate a new MyData.txt file. Has anyone ever written
code that will load MyTemplate.doc, instruct MyTemplate to mail merge into a
new document, then print the new document, save it and exit the new
document and MyTemplate.
Also, I may have to set some of the printer settings before I print it.
Thanks,
Keith
Doug Robbins - 08 Jul 2005 18:09 GMT
The following is untested, but should do what you want:
Dim mdoc As Document
Set mdoc = Documents.Add("MyTemplate.doc")
With mdoc.MailMerge
.OpenDataSource Name:="mydata.txt"
.Destination = wdSendToNewDocument
.Execute
End With
ActiveDocument.PrintOut
ActiveDocument.Save

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hi,
>
[quoted text clipped - 12 lines]
>
> Keith