Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to automate mailmerge form vfp7
Message
De
05/02/2004 16:16:21
 
 
À
05/02/2004 14:56:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00874569
Message ID:
00874595
Vues:
11
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform