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

Hide/show (disable/enable) a sheet via macros qlickview

I try to explain as best as possible


I need to hide a few sheets via vbscript macro, so that when i print the document they are not visible. i can retrieve a sheet via its id and then hide/show it?


example:

function Hide

  Dim strValueToDisplay
  strValue
= split(ActiveDocument.Variables("vHideSheetList").GetContent().String,",")
 
for each sheetId in strValue
 
  ActiveDocument.Sheets(sheetId).Hide
 
next

end function

function Show  

  Dim strValueToDisplay
  strValue
= split(ActiveDocument.Variables("vHideSheetList").GetContent().String,",")
 
for each sheetId in strValue
 
  ActiveDocument.Sheets(sheetId).Show
 
next

end function


4 Replies
Frank_Hartmann
Master II
Master II

why not setting up a variable for conditional view of the sheets?

then you are able to set this variable to a certain value per macro:

Function setVariable

set v=ActiveDocument.Variables("YOURVARIABLE")

       v.Forcecontent "1",1

END function   

hope this helps

Not applicable
Author

Because I have a need to hide / show a list of pages that the user chooses dynamically. Do not I have to show / hide them all together


thx!

MK9885
Master II
Master II

Why do you want to use Macros to hide/show sheet?

It is best to avoid Macros.

You can use Condition expression in sheet Properties to show/hide

Not applicable
Author

i know that i can hide/show sheet with the sheet properties

But i'm forced to use the procedure that i described before using macros ( using a list of sheet's id i want to use a loop to iterate the list  and hide all sheets leaving out those selected in the list)