Scripts For Operation Variables

Examples of VBA scripts used for accessing operation related variables are given.  These functions can be called directly from an Excel cell or from another VBA script.

Example 1: General for all operations

Function SetProcessTime(procName, opName, time) As Double

Dim var1 As Variant

Dim str1 As String

Dim str2 As String

str1 = CStr(procName)

str2 = CStr(opName)

var1 = CDbl(time)

Set SuperProDoc = DocumentObject()

SuperProDoc.SetOperVarVal str1, str2, VarID.processTime_VID, var1

SetProcessTime = CDbl(var1)

End Function

 

The above script is an example of a function used to set the process time of an operation using the Pro-Designer COM function SetOperVarVal (with arguments str1, str2, processTime_VID, var1).

 

Example 2: Operation Specific – for reaction operation

Function GetMassStoichCoeff(procName, opName, rxnName, compName) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim str1 As String

Dim str2 As String

 

str1 = CStr(procName)

str2 = CStr(opName)

var2 = CStr(rxnName)

var3 = CStr(compName)

 

Set SuperProDoc = DocumentObject()

SuperProDoc.GetOperVarVal3 str1, str2, massStoichCoeff_VID, var1, var2, var3

GetMassStoichCoeff = CDbl(var1)

End Function

 

The above script is an example of a function that returns the value of the mass stoichiometric coefficient of a component. The Pro-Designer COM function GetOperVarVal3 (with arguments str1, str2, massStoichCoeff_VID, var1, var2, var3) is used. In this case var1 takes the value of the stoichiometric coefficient, var2 is used to specify the reaction name, and var3 to specify the component whose coefficient we want to retrieve.