Applies To:
  • CitectSCADA 5.xx, 6.00, 6.00 Service Pack A

The following has been tested in CitectSCADA v5.50 Service Pack B:

Say you are calling a user-defined Cicode function (from a button) which is calling VbCall* commands to run a user-defined CiVBA function. The CiVBA function being called is supposed to display the value of a STRING variable tag using the MsgBox command:

Sub DspStr()
MsgBox strMyString
End Sub

It appears that the Compiler fails to compile the CiVBA function correctly so that during runtime, the Cicode function being called from a button fails to display the value of strMyString.

When you create a second button on the same page which calls the CiVBA sub-routine directly (which must be prefixed with the CiVBA keyword), then both the Cicode and CiVBA functions will display the value of strMyString. If the button calling the CiVBA function is removed from this same page, then the Cicode function will cease to work again.

This is a known issue. Unlike Cicode, CiVBA doesn't support some type of tags referenced directly in VBA functions, for instance, string tags. In VBA, a string variable can hold up to 64 K characters, but Cicode only allows up to 128. Because of this, you cannot directly use string tags inside a VBA function. There are two workarounds to overcome this problem.

1. Use CStr (VBA) function to convert the value of a string tag to a local VBA variable first, and then use this local variable in the rest of the function.

2. Define a parameter in the VBA function and pass the tag value in VbCallOpen.

All of above methods just pass the value of a string tag, NOT reference. This is the limitation of CiVBA.