The following VBA code will retrieve from a ProDesigner document the names of all input streams of a given procedure. In this code we assume that the variable SuperProDoc is a global variable that has been previously assigned to the document object of an SPD file.
Function GetInputStreamNamesForUP(procName as String)
Dim bContinue as Boolean
Dim streamName as Variant
Dim pos as Variant
Dim allStreamNames as String
bContinue = SuperProDoc.StartEnumeration(pos, _
ListTypeID.inStream_LID, _
ContainerTypeID.unitProc_CID, _
procName)
Do While (bContinue)
bContinue = SuperProDoc.GetNextItemName(pos, _
streamName, _
ListTypeID.inStream _LID, _
ContainerTypeID.unitProc _CID, _
procName)
allStreamNames = allStreamNames + CStr(streamName) + " "
Loop
End Function
Note that to involve the appropriate enumerator, we need to understand that the ‘container’ object for this list is a specific unit procedure (UP) with name <procName> (the argument of the above function). Therefore, when we start the enumeration we need to pass unitProc_CID as the ContainerTypeID parameter along with the name of the procedure (last argument), see Specifying Container Type. Of course, the ListTypeID (that specifies which type of list we are enumerating, see Specifying Item List Type) is inStream_LID.
Also note that the call to GetNextItem() will return ‘false’ to indicate that the returned value is the last one in the list, and therefore, the loop needs to terminate. If the list we are enumerating has no members (i.e., it’s empty) then the call to StartEnumeration() will fail.
To see example scripts on how to use the above enumerator functions (in the context of Streams and Material items) please view the ComEx8.xls file in the COM folder located under the "EXAMPLES" folder under your application’s installation directory