Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

activate a sheet whose id is a variable

Hello

I need to write a macro in which I want to activate sheets

I know that the syntax is as follows:

ActiveDocument.GetSheetByID("SH03").Activate

however the SH03 I have it in a variable

Please advise

I can walk on water when it freezes
1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

Say the variable is named vSheet in the QlikView application. Then the code should look like

Set s = ActiveDocument.Variables("vSheet")

ActiveDocument.GetSheetById(s.GetContent.String).Activate

Hope that helps.

Miguel

EDIT: Note that you can use a direct button action instead of a macro to activate a sheet depending on the value of a variable. Better off using this instead of using macro.

View solution in original post

1 Reply
Miguel_Angel_Baeyens

Hi,

Say the variable is named vSheet in the QlikView application. Then the code should look like

Set s = ActiveDocument.Variables("vSheet")

ActiveDocument.GetSheetById(s.GetContent.String).Activate

Hope that helps.

Miguel

EDIT: Note that you can use a direct button action instead of a macro to activate a sheet depending on the value of a variable. Better off using this instead of using macro.