General information
Category:
COM/DCOM and OLE Automation
>>I have a VFP 6.0 app that uses Word 2000 for automated mail merge to letter-
>>size documents. Data source is a 1000-record VFP table with no indexes. My
>>problem is that the best output rate I can get is 20 pages per minute. The
>>problem seems to be at the point of merge. It also seems to be exponential in
>>nature. For example, if I use 100 records instead of 1000, I get about 150
>>pages per minute.
>>F.Y.I. Word repagination is disabled
>>
>>Any ideas?
>
>Minimize cross-process calls. For example, if there's some complex formatting that you do a lot, create a style in Word, and apply it, rather than sending a bunch of single formatting commands.
Thanks for the reply, Garrett. I'm afraid this doesn't help me much, as all the formatting is done in the Word documents prior to runtime. Here's what my code is doing:
1. Loads a blank merge-enabled document into Word
lo_Document = lo_Word.Documents.Add('CMLETTER')
2. Loops through an array built from the merge file (each record in the merge file contains a reference to the Word doc to which it must be merged), specifying the Word document to insert next so it will synch to the appropriate merge table record.
3. Inserts the Word document ("insert" used instead of "open" to obviate necessity to re-establish link to the merge table for every document to be included.)
lo_Selection = lo_Word.Selection
lo_Selection.InsertFile(ls_pcDocument)
4. After all Word documents are inserted, does the merge
WITH lo_Document.MailMerge
.Destination = wdSendToNewDocument
.Execute
ENDWITH
5. Save the merged file
WITH lo_Word
.ActiveDocument.SaveAs((ls_DOCOutput))
.Documents.Close(wdDoNotSaveChanges)
.FileClose(2)
.Quit()
ENDWITH
The big performance hit seems to come with the statement
WITH lo_Document.MailMerge
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only