Word-Automation: Preview to all Mail-Merge Prints?

JutJut Member Posts: 72
Hallo!

I would like to extend the standard Codeunit 5054 WordManagement to create a preview for all pages prior to printing them. I tried to customize the function ExecuteMerge in the IF BEGIN - END Section where the printout will be done. There I would like to open one word-document with all merged letters. I tried it with the following code before the printout-comment:



TempDeliverySorter."Correspondence Type"::"Hard Copy":
BEGIN

wrdDoc := wrdApp.Documents.Open(MainFileName);
wrdMailMerge := wrdDoc.MailMerge;
wrdMailMerge.Destination := 0;
wrdMailMergeDS := wrdMailMerge.DataSource;
wrdMailMergeDS.FirstRecord(1);
wrdMailMergeDS.LastRecord(wrdMailMergeDS.RecordCount);
wrdMailMerge.Execute();
...
...
END

The problem is, that in this case the master-document with the defintion of the merge-fields will be opened as well. If I delete the first line, no document will be opened.

Can anybody help me?

Thanks a lot

Comments

  • matthewtaingmatthewtaing Member Posts: 52
    Sorry for bumping an old thread up, but I'm faced with similar situation where I would like to show only the final merged document. Have you been able to resolved this and how if you don't mind sharing?

    Thanks
Sign In or Register to comment.