CreateOleObject returns a pointer to an instantiated COM Object.

ClassName is either the Guid (Globally Unique Identifier), or name of the COM library you are attempting to load.

It is common to use this call in the OnStartMap of the master data view in the Map, and assign the result to a global variable.

This means the COM library is instantiated only once, and can then be used in other events. This is far quicker than re-instantiating the COM library each time the event is called, as would occur using local variant variables.

Your COM object references will be released from memory automatically - you do not need to delete or "free" them in your script.

Declaration: Function CreateOleObject(const ClassName: string): Variant;

An example follows, instantiating the COM library to a global variable.

procedure OnStartMapEvent(var Value:Variant);
begin
GLOBAL1 := CreateOleObject(<guidornameofcomlibrary>);
 
//in other events you can then use properties of the COM Object eg Global1.DoSomething();
end;

This example instantiates the COM library locally.

procedure OnMapEvent(var Value:Variant);
var
MyCOMObject : variant;
 
begin
MyCOMObject := CreateOleObject(<guidornameofcomlibrary>);
Value := MyComObject.DoSomething;
 
end;