| Michael 2004-03-31, 9:51 am |
| I am working on a mail merge program in visual basic.net. When I go to
print them out to the printer, it prints the copy with the data
merged, and it also prints the template. How can I only get it to
print the copy with the merged data? Below is my code
Private Sub Create_File()
wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
wrdDoc = wrdApp.Documents.Add(no_claim_doc_path)
wrdDoc.Select()
wrdSelection = wrdApp.Selection()
wrdMailMerge = wrdDoc.MailMerge()
wrdDoc.MailMerge.OpenDataSource(no_claim_ds_path)
wrdMailMerge.Destination =
Word.WdMailMergeDestination.wdSendToPrinter
wrdMailMerge.Execute()
wrdDoc.SaveAs(no_claim_doc_path)
wrdDoc.Close()
wrdSelection = Nothing
wrdMailMerge = Nothing
wrdMergeFields = Nothing
wrdDoc = Nothing
wrdApp = Nothing
End Sub
Thanks!
|