Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 9 of 9

Thread: Hiding an image

  1. #1
    Join Date
    25th January 2006
    Posts
    9

    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 at 01:24.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    22nd April 2003
    Location
    Virginia, USA
    Posts
    5,035

    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 at 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.

  3. #3
    Join Date
    25th January 2006
    Posts
    9

    Re: Hiding an image

    Quote 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.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    14th January 2005
    Location
    Cyprus
    Posts
    2,252

    Re: Hiding an image

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

    VB:
    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

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    25th January 2006
    Posts
    9

    Re: Hiding an image

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

    VB:
    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.

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    16th June 2005
    Location
    Dublin
    Posts
    4,498

    Re: Hiding an image

    You could try -

    VB:
    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 at 02:12.
    _______________________________________________
    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

    _______________________________________________

  7. #7
    Join Date
    25th January 2006
    Posts
    9

    Re: Hiding an image

    Quote Originally Posted by Ger Plante
    You could try -

    VB:
    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?

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    16th June 2005
    Location
    Dublin
    Posts
    4,498

    Re: Hiding an image

    See my "edit" in the above 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

    _______________________________________________

  9. #9
    Join Date
    25th January 2006
    Posts
    9

    Re: Hiding an image

    Quote 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!

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Auto Size Image In UserForm Image Control
    By idps in forum EXCEL HELP
    Replies: 8
    Last Post: February 8th, 2008, 22:34
  2. Display Image Based On Image Name in Cell
    By superemu in forum EXCEL HELP
    Replies: 3
    Last Post: September 4th, 2007, 13:32
  3. Replies: 17
    Last Post: November 10th, 2005, 23:12
  4. hiding an image? [RESOLVED]
    By black knight in forum EXCEL HELP
    Replies: 1
    Last Post: May 27th, 2005, 03:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno