Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

VbCallReturn Function

  • Last UpdatedJul 18, 2023
  • 1 minute read

Used to obtain the return value of the completed VBA function (previously opened with the Cicode VbCallOpen function), and requires the handle returned from the VbCallRun function call.

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

Syntax

ReturnValue = VbCallReturn(CallHandle)

ReturnValue:

The value returned by the completed VBA function (which was previously opened by the Cicode VbCallOpen function). The data type of the return value is dependent upon the data type of the return value for the VBA function opened.

CallHandle:

The handle to the previously opened VBA function as returned by the Cicode VbCallRun function

Return Value

VbCallReturn returns the completed return value for the VBA function.

VbCallOpen Function | VbCallRun Function

Example 1

FUNCTION
TestCitectVBA()
INT iRet;
STRING sMsg = "Hello";
INT iVal = 123;

iRet = VbCallReturn(VbCallRun(VbCallOpen("CiVBATest",
iVal)));
Message("TestCitectVBA Function", "CiVBATest = " +
IntToStr(iRet), 0);
END

Example 2

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

Example 3

FUNCTION VBA_from_Cicode()

INT iRet;

WHILE TRUE DO

iRet = TestFunc("TestVBA")

Sleep(5);

END

END

INT FUNCTION TestFunc(STRING sFun)

RETURN VbCallReturn(VbCallRun(VbCallOpen(sFun)));

END

In This Topic
TitleResults for “How to create a CRG?”Also Available in