WayneFrank
Member
In a Progress program, I save a Word document (from a merge)
chWord:ActiveDocument:SaveAs( file-name-var )
Now this Word document is open on my PC. Is there a way that from the Progress program that I can close this document?
Thanks
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.
DEFINE VARIABLE chSavedDoc 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 */
chMergeestination = {&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.
/* Brian from Progress. */
RELEASE OBJECT chDoc.
RELEASE OBJECT chMerge.
/* SCIS 855 */
IF Type-9-Y-N = "Y"
THEN DO:
chWordApp:ActiveDocument:SaveAs( "C:\Windows\Temp\list.docx" ).
END.
RELEASE OBJECT chNewDoc.
RELEASE OBJECT chWordApp.
chWord:ActiveDocument:SaveAs( file-name-var )
Now this Word document is open on my PC. Is there a way that from the Progress program that I can close this document?
Thanks
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.
DEFINE VARIABLE chSavedDoc 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 */
chMergeestination = {&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.
/* Brian from Progress. */
RELEASE OBJECT chDoc.
RELEASE OBJECT chMerge.
/* SCIS 855 */
IF Type-9-Y-N = "Y"
THEN DO:
chWordApp:ActiveDocument:SaveAs( "C:\Windows\Temp\list.docx" ).
END.
RELEASE OBJECT chNewDoc.
RELEASE OBJECT chWordApp.