CitectVBA Programming Reference > Integrating CitectVBA into your project > Accessing Cicode Tags with CitectVBA

Accessing Cicode Tags with CitectVBA

CitectVBA can use your CitectSCADA 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.

Note: Project variable tags are defined (in CitectSCADA) by using the Variable Tags form in the Citect Project Editor. For details, see Adding a Variable Tag.

For instance, in the following example, two variable tags in your CitectSCADA 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 CitectSCADA 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:

CitectSCADA 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 CitectSCADA project, consider using the [General]TagStartDigit Citect.INIparameter.

See Also

Using CitectVBA in CitectSCADA Command or Expression fields>Calling CitectVBA from Cicode

Calling CitectVBA from Cicode