Variable.SubItemCount



SubItemCount() As Long
ED
read only
RT
read only

Remarks

This method returns the number of sub items in an array or structure.

Sample:


Sub CountItems()

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

Debug.Print "Count items = " & zVariable.SubItemCount

End Sub

See Also

Variable