02-08-2018 6:17 AM
I am developing a program with OLE2OBJECT for processing the MS word file. But, The system sometimes process already opened word file instead of the desired file. So, I want to check in the beginning of my program, if MS word is already running or not. How can I check this.
Regards,
Dipeshkumar Bhavsar
02-08-2018 7:04 AM
Usually solved with method get 'GetObject' on 'Word.Application' , if assign successfull (and '.Documents.count.' > 0) then Word is already running (with at least one opened document) else use 'CreateObject'. (But usually in some VBscript, CL_GUI_FRONTEND_SERVICES=>EXECUTE, etc.)
02-08-2018 7:27 AM
Hi Raymond,
Thanks for your answer. But, I am struggling to get the value back in SAP for Documents.Count. If you can help me how to get the value back in SAP.
Regards,
Dipeshkumar Bhavsar
02-08-2018 8:08 AM
In vba, code would look like
Dim wdApp As Object
Set wdApp = GetObject(, "Word.Application")
Debug.Print wdApp.Documents.Count
Set wdApp = Nothing
02-08-2018 9:32 AM
I know the VBA Code. But, how to replicate the same in SAP? This GetObject is a function not the method or property. so, it is hard to call within the ABAP code.