CitectSCADA expects that all code contained within a CitectSCADA Command or Expression field to be Cicode by default. When using CitectVBA code script directly in a CitectSCADA Command or Expression field within CitectSCADA, you must precede the CitectVBA script with the keyword CiVBA, as shown here:
TestTag_1 = TestTag_1 + 1
This is known as the language override command. When the CitectSCADA compiler reads the keyword CiVBA, it knows to handle that code (within the same CitectSCADA Command or Expression field) as CitectVBA script, and compiles it as such. No such override command is required to use Cicode.
The CiVBA language override statement must be placed first in the CitectSCADA Command or Expression field if you want to use CitectVBA script code instead of Cicode in that CitectSCADA Command or Expression field.
Note: You must use either Cicode or CitectVBA in a CitectSCADA Command or Expression field. You cannot change or swap between the two programming languages (within the same CitectSCADA Command or Expression field) once you've started using one or the other.
You can, however, call a single Cicode function
from within CitectVBA script if you wrap the Cicode call within
special CitectVBA functions
CicodeCallReturn(). For details, see Calling Cicode from
Alternatively, to call a single CitectVBA function
(from within the CitectSCADA Command or Expression
field) after you have already used Cicode in that field, you can
wrap the CitectVBA within three nested special Cicode functions:
VbCallReturn(). See Calling Cicode from
Accessing Cicode Tags with CitectVBA
Accessing ActiveX Objects with CitectVBA
Multithread Considerations with CitectVBA
Calling CitectVBA from Cicode
Calling Cicode from CitectVBA