Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to to Mail-Merge with Word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00208736
Message ID:
00210057
Vues:
19
>Hi,
>Can you recommend any books/resources for VBA programming of Word? I need to do a mail-merge and am not quite sure how to do it. If the user tells me the name of the document, can I query the document to find out what fields it expects, etc.?
>TIA,

Hi William, here is how I do it.

*-- Office 97 --*
oWord = CREATEOBJECT("Word.Application")
oWord.Documents.Open("Reports\MergeDoc.doc")
oWord.Documents("MergeDoc.doc").Select

*-- Destination (0 - New Word doc)
*-- (1 - To printer. Incl. dialogbox)
oWord.Documents("MergeDoce.doc").MailMerge.Destination = 0

oWord.Documents("MergeDoc.doc").MailMerge.Execute
oWord.Activedocument.Printout
oWord.Activedocument.Close
oWord.Documents("MergeDoc.doc").Close
RELEASE oWord
Benn Kjaer
MS Certified Professional - Visual Foxpro

"There is something rotten in the state of Denmark"
"Why make user-friendly programs, when there aren’t any friendly users :o)"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform