SET ... NOTHING procedure

Purpose:

COMSET ... NOTHING procedure must be called for each created COM/ActiveX object to release all memory resources allocated by a call to CREATEOBJECT or by BCX_DISPATCHOBJECT functions.

Syntax:

COMSET COMObject = NOTHING

Example:

CLS

DIM COMObject AS OBJECT

COMSET COMObject = CREATEOBJECT("Excel.Application")

IF BCX_COM_ERROR THEN
  PRINT BCX_GET_COM_ERROR_DESC$
  END
END IF

COMObject.visible = true

SLEEP(2000) ' Excel will be visible for 2 sec, and than it will close. 

COMObject.activeworkbook.saved = true ' don't prompt to save workbook 

COMObject.quit

COMSET COMObject = NOTHING ' remember to call Set xxx = Nothing 
                     ' to release resources used by COM object!!! 
 
KEYPRESS

For more examples of the BCX COM functions see the COM directory at the https://bcxbasiccoders.com/archives/YahooGroups/Com/ website.

Related topics: Object data type definition | CREATEOBJECT | List of all COM Interface Functions