Consultor Eletrônico



Kbase P90901: How to avoid to create a new ActiveX if the process is already running
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/12/2004
Status: Verified

GOAL:

How to avoid to create a new ActiveX if the process is already running

GOAL:

How to create an Automation Object only if the process is not running yet

GOAL:

What is the equivalent of Visual Basic GetObject function call?

GOAL:

How to connect to an Excel session which is already opened?

FIX:

When you CREATE an Automation Object you may choose for 4 different behaviors, according to the 4 different options available in the CREATE statement.

In this case you could write: DEFINE VARIABLE hExcelObject AS COM-HANDLE. /*connect only to an existing Excel Process*/
CREATE "Excel.Application" hExcelObject CONNECT NO-ERROR. /*If no existing server was running create a new one*/
IF NOT VALID-HANDLE(hExcelObject) THEN CREATE "Excel.Application" hExcelObject .