Remarks | Properties | Methods | Samples |
ED
|
avaliable
|
RT
|
read only
|
The VarAssignments collection contains all existing allocations of the current project. With this collection you can access all or certain allocations. Additional to the access via the index the allocations can also be accessed via the unique name or the position.
Count | Parent |
CheckIn | CheckOut | Create |
CreateByID | Delete | Export |
Get | Import | IsCheckedOut |
IsDifferent | IsLocked | Item |
UndoCheckOut |
'Create a new VarAssignment (Allocation) Sub CreateAssignment() Dim zVarAssign As VarAssignment Dim zSrcVar As Variable Dim zDstVar As Variable 'by NAME Set zVarAssign = MyWorkspace.ActiveDocument.VarAssignments.Create("MyAssignment", "WIZ_VAR_10", "WIZ_VAR_11") 'OR by ID Set zSrcVar = MyWorkspace.ActiveDocument.Variables.Item("WIZ_VAR_10") Set zDstVar = MyWorkspace.ActiveDocument.Variables.Item("WIZ_VAR_11") Set zVarAssign = MyWorkspace.ActiveDocument.VarAssignments.CreateByID("MyAssignment", zSrcVar.PvID, zDstVar.PvID) End Sub 'Delete an VarAssignment (Allocation) Sub DeleteAssignment() Dim bResult As Boolean 'by NAME bResult = MyWorkspace.ActiveDocument.VarAssignments.Delete("MyAssignment") End Sub 'Enumerate all Assignements of the active project Sub EnumAssignments() Dim zVarAssign As VarAssignment Dim zVarAssigns As VarAssignments Dim i As Integer 'get collection of VarAssignements Set zVarAssigns = MyWorkspace.ActiveDocument.VarAssignments 'enum all VarAssignments For i = 0 To zVarAssigns.Count - 1 'get VarAssignment Set zVarAssign = zVarAssigns.Item(i) Debug.Print zVarAssign.Name & " [" & _ zVarAssign.DynProperties("SourceVariable").Name & " > " & _ zVarAssign.DynProperties("TargetVariable").Name & "]" Next i End Sub