Commonly used sequences of CitectVBA statements can be grouped together into functions and subroutines, so that they can be keyed in once, and used many times in many places, by 'calling' the name of the subroutine or function in code.
A subroutine or function is a group or list of sequential statements that CitectVBA can perform (execute) in the logical order that they exist within the subroutine or function from top to bottom in the order they are listed within the function or subroutine.
If the group of statements returns a value, it must be declared as a function. If it does not return a value, it must be declared as a subroutine. A subroutine or function is called by placing the name of the subroutine or function in a code statement where you want the action of the subroutine or function to occur.
Note: Subroutines and functions can contain statements that call other subroutines or functions (to perform, before returning to the following statements within the calling subroutine or function).
Both subroutines and functions can similarly be passed values as arguments when they are called:
Note:CitectSCADA tag values must be declared by value when passed as argument values to a CitectVBA procedure from within a CitectSCADA command or expression field (see Passing variables Byref and Byval).
See Also