Scripts For Procedure Variables

Examples of VBA scripts used for accessing procedure related variables:

Example 1: Get the number of operations in a procedure

Function NumberOfOperationsInProcedure(procedureName) As Long

Dim var1 As Variant

Dim str As String

str = CStr(procedureName)

Set SuperProDoc = DocumentObject()

SuperProDoc.GetUPVarVal str, VarID.numberOfOperations_VID, var1

NumberOfOperationsInProcedure = CLng(var1)

End Function

 

The above script is an example of a function used to retrieve the number of operations of a procedure. The Pro-Designer COM function GetUPVarVal (with arguments str, numberOfOperations_VID, var1) is used.

 

Example 2: Set the number of cycles in a procedure

Function SetAndGetNoOfCyclesInProcedure(procedureName, noCycles) As Long

Dim var1 As Variant

Dim str As String

str = CStr(procedureName)

var1 = CLng(noCycles)

Set SuperProDoc = DocumentObject()

SuperProDoc.SetUPVarVal str, VarID.numberOfCycles_VID, var1

SuperProDoc.GetUPVarVal str, VarID.numberOfCycles_VID, var1

SetAndGetNoOfCyclesInProcedure1 = CLng(var1)

End Function

 

The above script is an example of a function used to setting the number of cycles in a procedure. The Pro-Designer COM function GetUPVarVal (with arguments str, numberOfCycles_VID, var1) is used.

Note that in this case we use var1 = CLng(noCycles)  to specify that the type of noCycles is Long (If noCycles referred to an excel cell then it could be used without casting it). Another way of specifying the type of noCycles is to include its type on the function statement as shown on the script below:

 

Function SetAndGetNoOfCyclesInProcedure(procedureName, noCycles As Long) As Long

Dim var1 As Variant

Dim str As String

str = CStr(procedureName)

Set SuperProDoc = DocumentObject()

var1 = noCycles

SuperProDoc.SetUPVarVal str, VarID.numberOfCycles_VID, var1

SuperProDoc.GetUPVarVal str, VarID.numberOfCycles_VID, var1

SetAndGetNoOfCyclesInProcedure = CLng(var1)

End Function