>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:
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