Scripts For Equipment Variables

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

 

Example 1: Set the Replacement Frequency of a Consumable

Function SetAndGetConsReplFreq(equipName, consName, consNameType, consFrequency) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim var3 As Variant

Dim str As String

 

Set superProDoc = DocumentObject()

var1 = CDbl(consFrequency)

var2 = CStr(consName)

var3 = CStr(consNameType)

str = CStr(equipName)

superProDoc.SetEquipVarVal3 str, VarID.consumableReplFreq_VID, var1, var2, var3

var1 = 0.0 ' Reset to 0 so as for testing purposes

superProDoc.GetEquipVarVal3 str, VarID.consumableReplFreq_VID, var1, var2, var3

 

SetAndGetConsReplFreq = CDbl(var1)

End Function

 

The above script is an example of a function used to set the replacement frequency of a consumable used in a specific equipment. The Pro-Designer COM function SetEquipVarVal3 (with arguments str, consumableReplFreq_VID, var1, var2, var3) is used. The first argument (str) takes the name of the equipment, and var1 takes the value of the replacement frequency. The extra arguments var2 and var3 are used to specify the consumable name and type. The function then retrieves the value of the consumable replacement frequency and returns that value.