You can integrate CitectVBA into your Citect SCADA project in two ways:
In either case, all procedures within a CitectVBA script can access (read and write) any Citect SCADA variable tag in the same way as Cicode can access Citect SCADA tags. See Accessing Cicode Tags with CitectVBA.
For details about accessing ActiveX objects using CitectVBA, see Accessing ActiveX Objects 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 of using tags that have a number as their first digit in your project, consider using the [General]TagStartDigit Citect.INIparameter.
ActiveX objects which have been added to a graphics page in your Citect SCADA project can be referred to in CitectVBA by constructing a unique reference name using the page name, the underscore character, the letters 'AN', and the animation number of the object.
This reference name is called the Event Class name in Citect SCADA. To view the reference name, double-click the ActiveX object, select the Access tab, then click the Identification tab.
In this example, the reference name for the Temperature meter object would be referred to in CitectVBA as ActiveX_AN125.
All object properties can be accessed and manipulated using CitectVBA in the same way that object properties can be manipulated using Cicode.
Published June 2018