Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Is there any way to iterate the variables in macro?
Just to be clear, I am not asking how to write a loop in VBScript.
Right now i have a code like this
Set vStore1 = ActiveDocument.Variables("vStore1")
Set vStore2 = ActiveDocument.Variables("vStore2")
Set vStore3 = ActiveDocument.Variables("vStore3")
Set vStore4 = ActiveDocument.Variables("vStore4")
Set vStore5 = ActiveDocument.Variables("vStore5")
and what i want is
for each var in ActiveDocument.Variables
// do something with var
next
I know ActiveDocument.Variables can not be used this way. it is just to show the solution i want.
Regards,
Jean
It's not quite clear for what do you want to do. But this snippet from the APIGuide.qvw should be helpful for you:
rem ** Show name of all variables in document **
set vars = ActiveDocument.GetVariableDescriptions
for i = 0 to vars.Count - 1
set v = vars.Item(i)
msgbox(v.Name)
next
- Marcus