For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > March 2004 > Mail Merge









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mail Merge
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!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com