Announcement

Collapse
No announcement yet.

Hiding an image

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hiding an image

    I apologize if this has been discussed beforehand, but I could not find a solution.

    I am looking to use a command button to hide an image (a simple "watermark" on the page) in Excel. I have used command buttons in the past to hide columns, etc., but I can't seem to figure out how to do this. I have found ways to make all images or objects on the page disappear, but I only want the one image to disappear.

    Thanks for the help.
    Last edited by SKeefe; May 16th, 2006, 01:24.

  • #2
    Re: Hiding an image

    I may be confusing myself with the way Word works, but I seem to remember a watermark needing to be imbedded in a header or footer. Perhaps your need to use you VBA code to EDIT the Header or Footer containingthe watermark.
    Last edited by thomach; May 16th, 2006, 01:36.
    Best Regards,
    Tom
    ---------------------------
    Please help Oz share knowledge among all users by posting your questions in a public forum rather than using a Private Message.

    Comment


    • #3
      Re: Hiding an image

      Originally posted by thomach
      I may be confusing myself with the way Word works, but I seem to remember a watermark needing to be imbedded in a header or footer. Perhaps your need to use you VBA code to EDIT the Header or Footer containingthe watermark.
      Actually, the "watermark" that I made in Excel is really just a regular old transparent image.

      Comment


      • #4
        Re: Hiding an image

        If it just a shape you could create a toggle something like

        Code:
        Private Sub CommandButton1_Click()
        If Me.Shapes("picture 2").Visible = False Then
            Me.CommandButton1.Caption = "Shape Off"
            Me.Shapes("picture 2").Visible = True
        Else
            Me.CommandButton1.Caption = "Shape On"
            Me.Shapes("picture 2").Visible = False
        End If
        End Sub
        You may need to find the shape name before. Try right click assign macro.

        HTH

        Carl
        locii Insight
        Locii Solutions. Business IT Training. Business Consulting. Excel Training. Business Intelligence using Excel 2010. Cyprus.

        Comment


        • #5
          Re: Hiding an image

          Originally posted by carlmack
          If it just a shape you could create a toggle something like

          Code:
          Private Sub CommandButton1_Click()
          If Me.Shapes("picture 2").Visible = False Then
              Me.CommandButton1.Caption = "Shape Off"
              Me.Shapes("picture 2").Visible = True
          Else
              Me.CommandButton1.Caption = "Shape On"
              Me.Shapes("picture 2").Visible = False
          End If
          End Sub
          You may need to find the shape name before. Try right click assign macro.

          HTH

          Carl
          Hmm, I tried something like this before but the problem I ran into was finding the shape name. When you say "Try right click assign macro," what exactly do you mean. I right clicked the image, hit assign macro, and then what? I tried putting a name there and then replace "picture 2" in your code with that name, but it didn't work.

          Comment


          • #6
            Re: Hiding an image

            You could try -

            Code:
            ActiveSheet.Shapes("rectangle 1").Fill.Visible = msoFalse
            ActiveSheet.Shapes("rectangle 1").Line.Visible = msoFalse
            This just sets the visible property of the fill and line to False.

            Ger

            EDIT: Just saw your query above... if you click on the shape - the name should appear in the smaller top left hand box - beside the formula entry box.
            Last edited by Ger Plante; May 16th, 2006, 02:12.

            Check out our new reputation system. Click on the "star" under the post!
            _______________________________________________

            There are 10 types of people in the world. Those that understand Binary and those that dont.

            Why are Halloween and Christmas the same? Because Oct 31 = Dec 25...

            The BEST Lookup function of all time

            Dynamic Named Ranges are your bestest friend

            _______________________________________________

            Comment


            • #7
              Re: Hiding an image

              Originally posted by Ger Plante
              You could try -

              Code:
              ActiveSheet.Shapes("rectangle 1").Fill.Visible = msoFalse
              ActiveSheet.Shapes("rectangle 1").Line.Visible = msoFalse
              This just sets the visible property of the fill and line to False.

              Ger
              Ahh, good idea. Again though, don't I need to know the "name" ("rectangle 1" in your example) of the image?

              Comment


              • #8
                Re: Hiding an image

                See my "edit" in the above post.

                Check out our new reputation system. Click on the "star" under the post!
                _______________________________________________

                There are 10 types of people in the world. Those that understand Binary and those that dont.

                Why are Halloween and Christmas the same? Because Oct 31 = Dec 25...

                The BEST Lookup function of all time

                Dynamic Named Ranges are your bestest friend

                _______________________________________________

                Comment


                • #9
                  Re: Hiding an image

                  Originally posted by Ger Plante
                  See my "edit" in the above post.
                  Ahh, I feel dumb, not sure why I had never noticed that before.

                  Thanks for the help everyone!

                  Comment

                  Working...
                  X