Retrieves a registered COM object.
Note: On macOS, this function attaches to a running application and throws if it is not running.
ComObj := ComObjActive(CLSID)
Type: String
CLSID or human-readable Prog ID of the COM object to retrieve.
On Linux, the D-Bus target to connect to, in the form described under Interprocess automation with ComObject.
Type: ComObject
This function returns a new COM wrapper object with the variant type VT_DISPATCH (9).
An exception is thrown on failure.
On Linux, an error is thrown if no service currently owns the requested bus name.
ComValue, ComObject, ComObjGet, ComObjConnect, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (Microsoft Docs)
Windows only. Displays the active document in Microsoft Word, if it is running. For details about the COM object and its properties used below, see Word.Application object (Microsoft Docs).
try word := ComObjActive("Word.Application")
if not IsSet(word)
MsgBox "Word isn't open."
else
MsgBox word.ActiveDocument.FullName