CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Scope of CitectVBA > Procedural (local) level scope

Procedural (local) level scope

Variables and constants declared (using the Dim, Static, or Conststatements) within a CitectVBA procedure (subroutine or function) have local scope to only that within the procedure. This means that procedural level variables and constants cannot be referenced (accessed and used) from anywhere outside of that procedure.


Do not use the Global, Public, or Private keywords in your CitectVBA procedures. Using these keywords in procedures can lead to unintended equipment operation when your program is run.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

Procedural level variables declared using the Dimstatement do not retain their assigned values when dereferenced. Procedural level variables declared using the Staticstatement, however, do retain their assigned values between references, even after that procedure moves out of scope.