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
0
Comments
Thanks