Variable.SubItemName



SubItemName(lIndex As Long) As String

Parameters

lIndex As Long
Position of the element in the array or structure (starts at 0).
ED
avaliable
RT
read only

Remarks

This method returns the name of an array or structure item.

Sample:


Sub SubItemNames()

Dim zVariables As Variables 'Object from type Variables
Dim zVariable As Variable 'Child object from type Variables
Dim zDrivers As Drivers 'Object from type Drivers
Dim zVarTypes As VarTypes 'Object from type VarTypes

'Fill the objects
Set zVariables = MyWorkspace.ActiveDocument.Variables
Set zDrivers = MyWorkspace.ActiveDocument.Drivers
Set zVarTypes = MyWorkspace.ActiveDocument.VarTypes

'Create a "intern driver" array variable called "array" from object type "internal variable", datatype "INT", start at index 1,
'dimension of 5 and automatic addressing
Set zVariable = zVariables.CreateArrayVar("array", zDrivers.Item(0), 33, zVarTypes.Item("INT"), 1, 5, 0, 0, True, False, False)

'Activate all array elements
For i = 0 To 4
	zVariable.ActivateSubItem (i)
Next i

'Show the name of all array elements
For i = 0 To zVariable.SubItemCount - 1
Debug.Print "Name of first sub item = " & zVariable.SubItemName(i)
Next i

End Sub


See Also

Variable