...
FORMAT(TempDeliverySorter."Correspondence Type")));
IF TempDeliverySorter.FIND('-') THEN
NoOfRecords := TempDeliverySorter.COUNT;
Attachment.GET(TempDeliverySorter."Attachment No.");
WITH TempDeliverySorter DO BEGIN
SETCURRENTKEY("Attachment No.","Correspondence Type",Subject);
FIND('-');
END;
...
...
FORMAT(TempDeliverySorter."Correspondence Type")));
IF TempDeliverySorter.FIND('-') THEN
NoOfRecords := TempDeliverySorter.COUNT;
Attachment.GET(TempDeliverySorter."Attachment No.");
// Add the following lines.
// Handle Word documents without mergefields
IF NOT DocContainMergefields(Attachment) THEN BEGIN
MainFileName := ConstDocFilename;
Attachment.ExportAttachment(MainFileName);
CASE TempDeliverySorter."Correspondence Type" OF
TempDeliverySorter."Correspondence Type"::"Hard Copy":
BEGIN
wrdDoc := wrdApp.Documents.Open(MainFileName);
HandleWorddocwithoutmerge(wrdDoc,TempDeliverySorter,MainFileName);
ParamBln := FALSE;
wrdDoc.Close(ParamBln);
END;
TempDeliverySorter."Correspondence Type"::"E-Mail":
BEGIN
// Send attachment to all contacts in buffer
Window.UPDATE(6,Text009);
Attachment.TESTFIELD("File Extension");
HandleWorddocwithoutmerge(wrdDoc,TempDeliverySorter,MainFileName);
DeleteFile(MainFileName);
END;
END;
EXIT;
END;
// End of the lines.
WITH TempDeliverySorter DO BEGIN
SETCURRENTKEY("Attachment No.","Correspondence Type",Subject);
FIND('-');
END;
...