For Each pIT In ActiveDocument.ActiveLayer.PageItems
Dim myVar As Illustrator.Variable = AiApp.ActiveDocument.Variables.Add()
myVar.Kind = AiVariableKind.aiVisibility
myVar.Name = pIT.Name & i
pIT.VisibilityVariable = myVar
Next