CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Scope of CitectVBA > Global level scope

Global level scope

Variables declared (using the Dim, Global, or Publicstatements) at the modular level (outside any procedure) in a CitectVBA module (file), have global scope within the CitectSCADA 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 CitectSCADA command or expression fields.

Procedures (subroutines or functions) declared within a CitectVBA file module, like global variables, have global scope within a CitectSCADA project. They can be referenced or called from any CitectVBA module, as well as from any CitectSCADA command or expression field.

Equally important, all CitectSCADA 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 CitectSCADA project tags using CitectVBA, see Integrating CitectVBA with CitectSCADA.

Global level variables will also retain their assigned values between subsequent references, behaving somewhat similarly to the values stored in CitectSCADA tags. In this regard, Globaland Publicstatements are redundant at the modular (global) level in CitectVBA, as they perform the exact same duty as the Dimstatement.

See Also

Multithread Considerations with CitectVBA

CitectVBA Files