CreateArrayVar(strName As String,lpDriver As LPDISPATCH,kTypes As tpKanaltypes,lpVarType As LPDISPATCH,lLBound As Long,lDimension1 As Long,lDimension2 As Long,Dimension3 As Long,bPacked As Boolean,bStartAtNewOffset As Boolean,bReserved As Boolean) As Variable


strName As String
Name of the array variable as string.
Needs a driver as an object. Example: zDrivers.Item(0)
kTypes As tpKanaltypes
Channel type as a constant.
List of constants: tpKanaltypes
Needs the datatype of the variable as an object. Example: zVarTypes.Item("INT")
lLBound As Long
Set the array start index (0 or 1).
lDimension1 As Long
Set the number of elements for the first array dimension.
lDimension2 As Long
Set the number of elements for the second array dimension.
Dimension3 As Long
Set the number of elements for the third array dimension.
bPacked As Boolean
Set or reset the "automatic addressing" item of an array variable.
bStartAtNewOffset As Boolean
Set or reset the "each datatype start with new offset" item of an array variable.
Hint: If the "automatic addressing" item is reseted then this item will be greyed.
bReserved As Boolean
reserved boolean flag, not used at this time.
not used


With this method you are able to create an array variable within a project.


Sub CreateArrayVariable()

Dim zVariables As Variables 'Object from type Variables
Dim zVariable As Variable 'Child object from type Variables
Dim i As Integer

'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 "ArrayVar" from object type "internal variable", datatype "INT", start at index 1,
'dimension of 5 and automatic addressing
Set zVariable = zVariables.CreateArrayVar("ArrayVar", 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

End Sub

See Also

Variables, Variable