OLE Automation Objects
- Last UpdatedJul 18, 2023
- 1 minute read
VBA supports the referencing and control of OLE Automation objects of external applications, permitting you to use the properties, methods and events of those objects from within Plant SCADA.
To access an OLE Automation object using VBA, you must first declare an object variable in your VBA code, then assign an OLE Automation reference to the variable. See Declaration of OLE Automation objects in VBA, and Assigning references to OLE Automation objects in VBA.
Objects declared in a VBA Sub or Function procedure are local to that procedure, and their lifetime ends along with the end of the procedure. An object declared outside a procedure has modular scope to all procedures within the same VBA file module and lasts for the lifetime of the variable that retains the reference to the object.
All object references must be deleted when they are no longer required, to release the memory they were using.
When considering the use of OLE Automation, you should be aware that there are different uses of OLE which have developed over the years and which may be confused with one another.