Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Is there any way to get list of variables in macros.
actually i have a long list of variables and want to set values to them by looping through them?
Regards,
Sab
Hi Sab,
Change the following macro code to set your variables properties or anything.
Sub ShowVars
varNo = ActiveDocument.GetVariableDescriptions.Count - 1
For i = 0 to varNo
MsgBox(ActiveDocument.GetVariableDescriptions.Item(i).Name)
Next
End Sub
or
Sub ShowVars
varNo = ActiveDocument.GetVariableDescriptions.Count - 1
For i = 0 to varNo
MsgBox(ActiveDocument.GetVariableDescriptions.Item(i).Name)
Set varActual = ActiveDocument.Variables(ActiveDocument.GetVariableDescriptions.Item(i).Name)
varActual.SetContent varActual.GetContent.String + 2, true
Next
End Sub
Hope that helps.
BI Consultant
Hi Sab,
Change the following macro code to set your variables properties or anything.
Sub ShowVars
varNo = ActiveDocument.GetVariableDescriptions.Count - 1
For i = 0 to varNo
MsgBox(ActiveDocument.GetVariableDescriptions.Item(i).Name)
Next
End Sub
or
Sub ShowVars
varNo = ActiveDocument.GetVariableDescriptions.Count - 1
For i = 0 to varNo
MsgBox(ActiveDocument.GetVariableDescriptions.Item(i).Name)
Set varActual = ActiveDocument.Variables(ActiveDocument.GetVariableDescriptions.Item(i).Name)
varActual.SetContent varActual.GetContent.String + 2, true
Next
End Sub
Hope that helps.
BI Consultant
Hi Miguel,
Thats helps.
Thanks you very much.
Sab