CitectVBA Programming Reference > CitectVBA Function Reference > Procedural Statements > CicodeCallReturn

CicodeCallReturn

The CicodeCallReturn function is used to obtain the return value of the most recently completed Cicode function opened and run with the CitectVBA CicodeCallOpen function.

No arguments are passed to the CicodeCallReturn function, as it will return the result of the most recent return-value for the Cicode function called by the CitectVBA CicodeCallOpen function.

The CicodeCallReturn function should be used in its own separate line of CitectVBA code and must not be nested with the CicodeCallOpen function. For details, see Calling Cicode from CitectVBA.

Syntax

ReturnValue = CicodeCallReturn()

ReturnValue:

The return value of the Cicode function specified in the most recent call of the CicodeCallOpen function. Note that the return data type of CicodeCallReturn will depend upon the return data type of the completed Cicode function most recently called by the CicodeCallOpen function.

Return Value

CicodeCallReturn returns the return-value of the completed Cicode function most recently called by the CicodeCallOpen function.

Related Functions

CicodeCallOpen

Example

' declare modular variant variable to store function results
Dim vntRet as Variant
Function TestCicode() As Integer
' declare local variables
Dim intRet As Integer
Dim strReply as String
Dim intMaxScale as Integer
' copy current tag value to variable
' uses the project variable tag named MAX_SCALE
intMaxScale = MAX_SCALE
' call Cicode function
' for example: TrnSetScale( AN, Pen, Percent, Scale)
intRet = CicodeCallOpen( "TrnSetScale", 53, -1, 100, (IntMaxScale) )
' Note the syntax used:
' - brackets around the CitectVBA function argument list
' - double quotes around the Cicode function name
' - no brackets around the Cicode function argument list
' - brackets around individual variable arguments

' test results
If intRet = 0 Then
'
' insert code for successful completion here
'
vntRet = CicodeCallReturn()
strReply = "CicodeCallOpen Function successfully called"
Else
'
' insert code for unsuccessful completion here
'
Select Case intRet
Case = 1
' assign return comment for this case
strReply = "CicodeCallOpen Function call error (unsuccessful)"
Case = 2
' assign return comment for this case
strReply = "Cicode Function not found"
Case = 3
' assign return comment for this case
strReply = "Wrong number of arguments "_
& "in Cicode CallOpen function call"
Case Else
' assign return comment for this case
strReply = "Unknown error"
End Select
End If

' display return comment for your information
MsgBox strReply
' assign return value for this function
TestCicode = intRet

End Function