Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Deleting a Sheet with a macro

Hello,

How do i remove a sheet in a qlik document using a macro?

Please help me.

Best regards and thanks in advance.

14 Replies
Not applicable
Author

Hi Onixdiana,

What do you mean with remove? delete? hide?

Please, let us know what exactly you want.

Best regards.

Not applicable
Author

Hi Miguel,

Both of the deleting or hiding represents a solution for want i need.

A have a document which has a macro for saving the document somewhere else, to reduce some data and then send that information via email.In this document, in the last sheet i put a button to activate the macro, but the person who will get the email is just a user and for preventing the push of that button, i want to hide/remove the entire sheet.

Thank you very much and i hope you will help me.

Best Regards.

Not applicable
Author

Hi OnixDiana,

here you are my solution, see the follow aspect:

  • Variable definition
  • 'ToHide' sheet properties (conditional showing)
  • Macro editor

I hope this help you.

Best regards

Not applicable
Author

I have Qlikview 8.1 installed on my pc and i can't open your file.

Can you try to send me again pls.

Not applicable
Author

Hi OnixDiana,

I don't have any problem sending it for you again, but it's very strange you can't open it, I've saved it for Qlikvie 6 to 8 version.

I hope you can download and open it correctly.

I've decided to describe the steps for get it:

  • Create a variable named v_hide and its start value will be 0
  • Copy the following code in macro editor
    • sub hide
      set v = activedocument.Variables("v_hide")
      if v.getContent.string = "1" then
      v.SetContent "0",true
      else
      v.SetContent "1",true
      end if
      end sub
  • In the sheet properties for the sheet to hide, put the following sentence in conditional showing: v_hide = 1
  • Link the button with the macro procedure
  • Try it !!

Best regards.

Not applicable
Author

This is the error the second time.

Ok thanks i will try and i will get back afterwards.

Not applicable
Author

I try it but i need to hide it before the macro sends the mail to the users. Sad

Anyway thank you very much.

Best Regards.

Not applicable
Author

Your application works correctly in my system. It hides the tab" To Hide " when the button is clicked and it again reappears when it is clicked the second time.

Not applicable
Author

Hi OnixDiana,

There isn't problem with that, you could call the procedure for sending mail in the same procedure like as following:

sub hide
set v = activedocument.Variables("v_hide")
if v.getContent.string = "1" then
v.SetContent "0",true
else
v.SetContent "1",true
end if
call send_mail
end sub

sub send_mail
msgbox "Sending mail"
end sub

I hope this help you.

Best regards.