CitectVBA objects can only be declared and referenced within CitectVBA file modules. CitectVBA modular objects have modular scope and cannot be referenced (accessed and used) from outside their CitectVBA module (file).
Note: CitectVBA objects cannot be used directly in CitectSCADA command or expression fields.
Once declared within a CitectVBA module, CitectVBA objects can be referenced and used in any procedure within the same code module. An object declared outside of a procedure has modular scope to all procedures within that same CitectVBA module (file). Objects declared within a Sub or Function procedure have local scope only within that procedure.
The object variable must be declared before it can be assigned an object reference. Object variables are declared by the Dim Statement with the As Object CitectVBA data type using the following syntax:
Dim <VariableName> As Object
where:
Note: The placeholder shown
inside arrow brackets (<placeholder
>) should be
replaced in any actual code with the value of the item that it
describes. The arrow brackets and the word they contain should not
be included in the statement, and are shown here only for your
information.
For example:
' create local variables to store object references
Dim objExcelApp As Object
Dim objWordApp As Object
Once declared, you can then assign an OLE Automation reference to the object variable in CitectVBA.
See Also
Deleting OLE automation objects