2 Replies Latest reply: Aug 18, 2011 2:26 PM by Jeff Jones RSS

    Hidden list box toggle

      Hello,

       

      I have a list box that will be locked and hidden.  I also have a button that I want to use to toggle the visibility of the list box.  I created a variable called "isVis" which is set to 1. 

      I have the action on the button running a macro that has:

      sub changeVis
           if isVis = 1 Then
                isVis = 2
           else
                isVis = 1
           end if
      end sub

       

       

      If anyone can tell me what is wrong with this that would be greatly appreciated!

      Thank you,

      Jeff

        • Hidden list box toggle
          Stephen Charles

          The code below is similar to what you want and should lead you in the right direction. You can also show or hide a list box using the "Show - Conditional" on the Layout tab.

          hth

          Stephen

           

          Sub ShowHide

          set v = ActiveDocument.Variables("vReport")

          if(v.GetContent.String)= "Crops" then

          set v = ActiveDocument.Variables("vShowHide")

                     v.SetContent  "2", True

          else

          set v = ActiveDocument.Variables("vShowHide")

                     v.SetContent  "1", True

          end if

           

          end sub