Question on Word merge from Progress

Posted by waynemckinstry on 04-Sep-2013 11:06

I am doing a Word merge from a Progress program. When I put a merge variable in the heading, the merge does not put a value in it. The merge variables in the body work fine. Funny thing is, if I use the same document and run the merge just from Word, the variable in the header gets its value just fine. From the Progress program, it skips the variable in the heading but does the variables in the body. ..Here is the code I am using...DEFINE VARIABLE chWordApp AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chDoc AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chMerge AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chNewDoc AS COM-HANDLE NO-UNDO. &GLOBAL-DEFINE wdSendToNewDocument 0 CREATE "Word.Application" chWordApp. chWordApp:ScreenUpdating = TRUE. chWordApp:visible = FALSE. chWordApp:displayAlerts = FALSE. /* open the template document */ chDoc = chWordApp:documents:OPEN(merge-form,,YES,FALSE).  /* set Mail Merge object */ chMerge = chDoc:MailMerge.  /* open the data source */  chMerge:OpenDataSource(input-file).  /* set merge file to correct type */ chMerge:MainDocumentType = merge-file-type. chMerge:SuppressBlankLines = FALSE. /* merge target is a NEW word Doc */ chMerge:Destination = {&wdSendToNewDocument}.  /* Run merge */ chMerge:EXECUTE.  /* Close merge form */ chdoc:CLOSE(FALSE). /* get handle to new document (the merged one) */ chNewDoc = chWordApp:ActiveDocument.  chNewDoc:fields:update.  chWordApp:visible = TRUE. chWordApp:ACTIVATE. RELEASE OBJECT chDoc. RELEASE OBJECT chMerge.  RELEASE OBJECT chNewDoc.  RELEASE OBJECT chWordApp.

All Replies

Posted by markl on 04-Sep-2013 11:09



I am currently out of the office, on annual leave, until Thursday 5th September.

If you have an urgent query please telephone 0191 2032500 for Orchard's Service Desk or email servicedesk@orchard-systems.co.uk, otherwise, I will respond to your email when I return.

This thread is closed