>I'm trying to do a mail merge from VFP using Word but I'm having some
>trouble. I can print an existing Word document from VFP, but the merge is
>a problem. What form must the data be in for Word to use it as a data
>source? Can it come directly from a DBF file? How do I programmatically
>merge the data with the document and print it? Any help would be greatly
>appreciated!
>
>This is what I tried:
>
>oPrint=createobject("word.basic")
>oPrint.AppMinimize()
>tcDocFile="sample.doc"
>oPrint.FileOpen(tcDocFile)
>oPrint.MailMergeToPrint() && doesn't work!
>oPrint.FileClose(2)
>
>Elyse Pomerantz
Elyse: Word will read Fox 2.x and FoxBase DBF files, but not VFP. You can always do a COPY TO of any data.
One caveat: The default setup for Word doesn't include the DBF readers. You may have to re-install that section if they weren't installed originally.
I tried to get a merge done automatically as well, but my clients decided they'd rather have an export to a specific file and then load/merge a pre-done document, allowing them to make minor changes each time. They're very happy with the DBF files, though, and often use the MSQuery to sort/filter the original file.
HTH
Barbara