Variables declared (using the Dim
, Global
, or Public
statements) at the modular level (outside any procedure) in a CitectVBA module (file), have global scope within the Citect SCADA project. This means that modular CitectVBA variables (except statics) can be referenced from both inside and outside of their file module.
Global level variables can be used directly within Citect SCADA command or expression fields.
Procedures (subroutines or functions) declared within a CitectVBA file module, like global variables, have global scope within a Citect SCADA project. They can be referenced or called from any CitectVBA module, as well as from any Citect SCADA command or expression field.
Equally important, all Citect SCADA variable tags, alarm tags, and ActiveX objects are accessible to all CitectVBA file modules (and their procedures) within that project, in the same manner as they have always been accessible to project Cicode files. For information about referencing Citect SCADA project tags using CitectVBA, see Integrating CitectVBA with Citect SCADA.
Global level variables will also retain their assigned values between subsequent references, behaving somewhat similarly to the values stored in Citect SCADA tags. In this regard, Global
and Public
statements are redundant at the modular (global) level in CitectVBA, as they perform the exact same duty as the Dim
statement.