Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to automate mailmerge form vfp7
Message
From
05/02/2004 16:16:21
 
 
To
05/02/2004 14:56:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00874569
Message ID:
00874595
Views:
10
>I'd like to automate this through vfp, so that users do not have to get out of vfp & into word to print the mail merged documents. I have this code setup in vfp, but it does not work:
>oWord=CREATEOBJECT('Word.Application')
>oWord.Documents.Open("formletter.doc")
>oDoc=oWord.ActiveDocument
>oDoc.MailMerge.Execute()
>
>I'd like vfp to automatically print the mail merged documents from within vfp. Is that possible? What am I missing / doing wrong?
>Thanks all!

The default for mailmerge is to merge to a new document. If you just want to print, you can do that in one of two ways. The first is to set it up before the merge:
* You'll have to look up the constant wdSendToPrinter 
oDoc.MailMerge.Destination = wdSendToPrinter 
oDoc.MailMerge.Execute
The second option has a little more flexibility. When you do the merge, the newly merged document becomes the active document and you can print it.
oDoc.MailMerge.Execute
oMergedDoc = oWord.ActiveDocument
oMergedDoc.PrintOut()
Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform