PB 12.6
I have an OLE Object being used to open a Word Document for the user to view. The issue that I have is that I do not know when or if the user closes the session of Word that gets launched so am not sure how to handle Destroying the object.
I appreciate any comments, examples, recommendations on how to handle this situation.
Thanks,
Bill
----------------------------
code snippet
----------------------------
at this point, the word document file name is stored in string variable ls_doc_file
// Declare local Ole Word Doc Object
OLEObject ole_obj_word_doc
// instantiate the ole object
ole_obj_word_doc = CREATE oleobject
// connect to WORD app
li_retval = ole_obj_word_doc.ConnectToNewObject("word.application")
IF li_retval < 0 THEN
DESTROY ole_obj_word_doc
MessageBox("Connecting to COM Object Failed", &
"Error: " + String(li_retval))
Return
END IF
// open the file
ole_obj_word_doc.documents.open(ls_doc_file)
// Make the object visible and display the
ole_obj_word_doc.Application.Visible = True
// *********************************************
// These are commented out because I don't know
// when the user closes the file.
// *********************************************
// shut down the server
//??ole_obj_word_doc.quit()
// destroy the object
//??DESTROY ole_obj_word_doc
// *********************************************
I have an OLE Object being used to open a Word Document for the user to view. The issue that I have is that I do not know when or if the user closes the session of Word that gets launched so am not sure how to handle Destroying the object.
I appreciate any comments, examples, recommendations on how to handle this situation.
Thanks,
Bill
----------------------------
code snippet
----------------------------
at this point, the word document file name is stored in string variable ls_doc_file
// Declare local Ole Word Doc Object
OLEObject ole_obj_word_doc
// instantiate the ole object
ole_obj_word_doc = CREATE oleobject
// connect to WORD app
li_retval = ole_obj_word_doc.ConnectToNewObject("word.application")
IF li_retval < 0 THEN
DESTROY ole_obj_word_doc
MessageBox("Connecting to COM Object Failed", &
"Error: " + String(li_retval))
Return
END IF
// open the file
ole_obj_word_doc.documents.open(ls_doc_file)
// Make the object visible and display the
ole_obj_word_doc.Application.Visible = True
// *********************************************
// These are commented out because I don't know
// when the user closes the file.
// *********************************************
// shut down the server
//??ole_obj_word_doc.quit()
// destroy the object
//??DESTROY ole_obj_word_doc
// *********************************************