Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merging Different Documents in Word
Message
 
To
07/03/2006 12:56:36
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01101747
Message ID:
01102733
Views:
19
Thanks much Tamar, I tried it and it works fine, something else,
we usually merge tens of documents in one shot, word merge each document
in it's own window, can it be done as one document with many pages instead?


Thank you very much for your help!




>>Thanks for replying Tamar, I have what you have just suggested,
>> I'm using a dbf as my data source, the first column in it stores the name of the template that should be merged with the data for that record, I just can't figure out how to instruct word to LOOP through all the records, open the template for that record and merge the data in that record
>>with the template, If you can guide me in the right direction I will apreciate it, right now I can only see a solucion with VB for applications or macro which i'm not familiar with.
>>
>
>Something along these lines. Note this is untested:
>
>
>* Assume oWord contains object reference to Word
>SELECT DataToMerge
>SCAN
>
>  oWord.Documents.Open(DataToMerge.Template)
>  oDoc = oWord.ActiveDocument
>
>  * Set up merge data
>  iKey = DataToMerge.iPK
>  SELECT * ;
>     FROM DataToMerge ;
>     WHERE iPK = iKey ;
>     INTO CURSOR OneRecToMerge
>
>  * Put merge data into Excel file for merge
>  cXLFile = FORCEPATH("MergeData.XLS",SYS(2023))
>  COPY TO MergeData TYPE XL5
>
>  * Attach to Document
>  oDoc.MailMerge.OpenDataSource(cXLFile)
>
>  * Merge
>  oDoc.MailMerge.Execute
>
>  * Now do something with the new document
>  oWord.ActiveDocument.PrintOut()
>
>  * Clean up
>  oWord.ActiveDocument.Close(0)
>  oDoc.Close(0)
>ENDSCAN
>
>
>Tamar
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Previous
Reply
Map
View

Click here to load this message in the networking platform