Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
samvile18
Creator III
Creator III

I'm trying to show an object based on msgbox

Hi All,

I'm trying to show the object TB01 if a user answers yes to a msgbox...I've got the following code but I'm struggling with the syntax to show or hide the object

sub ShowDetail()

vAnswer=msgbox("Do you want to view the raw data?",VBYesNo)

if vAnswer = VBYes then
     Code to show the object to go here

else
     Code to hide the object to go here

exit sub
end if

end sub

Can anyone please help?

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   You can do as follows.

   Create a variable say visibility. Set it to 1 (1 to show and 0 to hide).

   Go to Properties of Table box -> caption tab -> check show conditional -> type "=visibility =1"

   Change your macro to.

   sub ShowDetail()

   set var = ActiveDocument.Variables("visibility")

    vAnswer=msgbox("Do you want to view the raw data?",VBYesNo)

 

     if vAnswer = VBYes then
           var.setcontent "1",true  

     else
           var.setcontent "0",true  

     exit sub
end if

end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   You can do as follows.

   Create a variable say visibility. Set it to 1 (1 to show and 0 to hide).

   Go to Properties of Table box -> caption tab -> check show conditional -> type "=visibility =1"

   Change your macro to.

   sub ShowDetail()

   set var = ActiveDocument.Variables("visibility")

    vAnswer=msgbox("Do you want to view the raw data?",VBYesNo)

 

     if vAnswer = VBYes then
           var.setcontent "1",true  

     else
           var.setcontent "0",true  

     exit sub
end if

end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!