Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
word - Mail Merge to New Document
#6
Perhaps wdSendToPrinter for the MailMerge.Destination would work, but I'd need to have the user be able to select the printer.

When I run the following function it just prints to the default printer without prompting:
Function WordMerge
Code:
Copy      Help
;Open WordDoc, MailMerge with DataDoc, and output formatted MergedDoc

str WordDoc="$desktop$\MailMerge.doc"
str DataDoc="$desktop$\data.txt"
str MergedDoc="$desktop$\Merged.doc"

WordDoc.expandpath
DataDoc.expandpath
MergedDoc.expandpath

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application oApp._create
Word.Document d._getfile(WordDoc)
d.MailMerge.OpenDataSource(DataDoc)
d.MailMerge.Destination= wdSendToPrinter
d.MailMerge.Execute()
d.Close

Also, the WINWORD.exe is still running after this function runs. How do you properly close the document? I think it must be the merged document that is staying open...or something.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)