>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)"