Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Nov 2002
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing pictures

    Hi
    I want to create a 'hangman' type game in Excel. I have 5 pictures of a gallows in various stages of completion. As the value in a cell changes from 1 to 5 I would like to display the appropriate picture.

    I can get a picture to load but I cannot see how to delete the previous picture. I don't mind doing this on a sheet or on a form but I've not yet been able to link a picture on a form to a cell.

    Bob

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing pictures

    Try putting all pictures on top of each other and use this code:

    Thisworkbook.worksheets("Sheet1").Shapes("Picture 1").ZOrder msoBringToFront
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Lounger
    Join Date
    Nov 2002
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing pictures

    Thanks for that, it seems to work but it still leaves the other pictures on the worksheet. Isn't it possible to delete a picture - I mean I loaded it in so I must be able to delete it?

  4. #4
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing pictures

    I think pieterse's idea is, make all the pictures the same size and the same location, so that when you bring one to the front, the others get covered up. If you can still see them, set the backgrounds (fill) to opaque white (versus "no fill").

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing pictures

    Sure:

    Thisworkbook.worksheets("Sheet1").Shapes("Picture 1").Delete

    But that really deletes the picture. Maybe it is better to set it's visible property to False:

    Thisworkbook.worksheets("Sheet1").Shapes("Picture 1").Visible=False
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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