The trick with successfully using OLE Automation is determining what you can and can't do with it. In theory, you can do anything the OLE Automation server application can do. However, in practice, not every OLE Automation server application exposes all of its functionality through its OLE Automation interface.
You have to be able to use the native programming language of the OLE Automation server application in your code. You also need to know about the limitations imposed by the CitectSCADA operating environment, and its implementation of the CitectVBA programming language.
CitectVBA does not support early binding of OLE Automation objects, as there is no mechanism for providing a reference to the object type library (like you can do in Microsoft Visual Studio) until runtime. So, CitectVBA compile errors can occur with valid VBA code which may work well in other VBA supporting applications. Most ported VBA code will require some modification to compile and perform as expected in CitectVBA. For example, CitectVBA does not support the use of "With" statements concerning properties or methods of an object, yet does support the use of "For Each" statements with objects in a collection.
CitectVBA does not support the use of named arguments using the ":=" named argument operator (colon followed by an equal sign). Nor does it support the use of missing arguments using placeholder commas, however, CitectVBA does support the use of the "empty" keyword in place of missing arguments.
CitectVBA does not support the passing of SCADA variable tags by reference, however, the tag value can be copied to a CitectVBA variable, and it can be passed by value. See Passing Variables Byref and Byval with CitectVBA.
To help manage these considerations, you should know how to access the object model of the OLE Automation server applications. CitectVBA does not support the use of application-defined object types nor intrinsic constants due to late-binding of the object model. CitectVBA supports only 10 data-types, so be aware of the possibility of data being lost due to rounding when converting between different data types. See Rounding Numbers in CitectVBA.
To make full use of the OLE Automation object models, you should make yourself familiar with Object related terms. See Understanding object models in OLE Automation.
See Also