Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get list of variable names in macros

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

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

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.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

View solution in original post

2 Replies
Miguel_Angel_Baeyens

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.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

Hi Miguel,

Thats helps.

Thanks you very much.

Sab