ComObjActive

Retrieves a running object that has been registered with OLE.

ComObject := ComObjActive(CLSID)

Parameters

CLSID

Type: String

CLSID or human-readable Prog ID of the COM object to retrieve.

Return Value

Type: Object

This function returns a reference to a running COM object.

Error Handling

An exception is thrown on failure.

ComObject, ComObjCreate, ComObjGet, ComObjConnect, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (MSDN)

Examples

#1: Displays the active document in Microsoft Word, if it is running.

word := ComObjActive("Word.Application")
if !word
    MsgBox "Word isn't open."
else
    MsgBox word.ActiveDocument.FullName