Accessing Cicode Tags with CitectVBA

CitectVBA can use your Citect SCADA project variable tag and alarm tag variables in the same way as could Cicode (except for syntax differences). Both programming languages refer to a project's variable tags by using the name of the tags as defined in the project.

For instance, in the following example, two variable tags in your Citect SCADA project may be named B1_PUMP_101_SP and B1_PUMP_101_PV respectively, representing the Set Point and Process Variable values of Pump 101. These variable tag names can be used within a CitectVBA statement (just as you would use any other variable in CitectVBA). Both values can be read-from and written-to directly using CitectVBA:

' set pump speed to 500 rpm
B1_PUMP_101_SP = 500
' calculate pump speed error
Dim varPumpSpeedError
varPumpSpeedError = B1_PUMP_101_PV - B1_PUMP_101_SP

You should note that CitectVBA does not recognize Citect SCADA variable tags that are named with an initial digit (0-9).

To access such tags using CitectVBA, you must precede the tag name with a case-insensitive string containing the letters 'V', 'B,' and the underscore character (VB_) as in the following example:

Citect SCADA Tag Name:    "123Pump"
CitectVBA reference "VB_123Pump"

For details about accessing ActiveX objects using CitectVBA, see Accessing ActiveX Objects with CitectVBA. For details of using tags that have a number as their first digit in your Citect SCADA project, consider using the [General]TagStartDigit Citect.INIparameter.

See Also

Using CitectVBA in Citect SCADA Command or Expression fields>Calling CitectVBA from Cicode

Calling CitectVBA from Cicode

Published June 2018