CitectVBA Programming Reference > CitectVBA Function Reference > Procedural Statements > VbCallRun function

VbCallRun function

Used to execute the CitectVBA function or subroutine (previously opened with the Cicode VbCallOpen function), and requires the handle returned from the VbCallOpen function call.

The VbCallRun function provides an opportunity for the opened CitectVBA function to complete and return a value in the multi-threaded Citect/SCADA environment. It passes its argument value (of OBJECT data type) through as its return value upon completion.

VbCallRun is used in conjunction with VbCallOpen and VbCallReturn functions, which can all be nested to implement the entire function set with a single line of Cicode. For details, see Calling CitectVBA from Cicode.


ReturnValue = VbCallRun(CallHandle)


The handle to the opened CitectVBA function passed in as CallHandle.


The handle to the previously opened CitectVBA function as returned by the VbCallOpenfunction.

Return Value

VbCallRun (passes through and) returns a Object data type containing a handle to the CitectVBA function being called.

Related Functions

VbCallOpen function| VbCallReturn function


INT iRet;
STRING sMsg = "Hello";
INT iVal = 123;
iRet = VbCallReturn(VbCallRun(VbCallOpen("CiVBATest", iVal)));
Message("TestCitectVBA Function", "CiVBATest = " + IntToStr(iRet), 0);


Function CiVBATest(Value As Integer) As Integer
CiVBATest = Value * 2
End Function