This option creates a connection to an existing instance of a top-level Automation object (such as "Excel.Application"). This does not work with lower-level objects (such as "Excel.Sheet"), and fails if the Server is not already running. For example:

DEFINE VARIABLE hExcelObject AS COM-HANDLE NO-UNDO.

CREATE "Excel.Application" hExcelObject CONNECT.

The following figure summarizes the basic logic for this option.

Figure 1. Automation connection option 2


Note: This option is equivalent to the Visual Basic GetObject(,class) function call.