View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Displaying a picture by pushing CommandButton

If you already have it on the sheet in the position you want:

Private Sub cmdShowPic_Click()
With ActiveSheet.Pictures(1)
.Visible = Not .Visible
End With
End Sub

this was for a picture entered in the sheet using Insert=Picture (from
file).

If you need to do that, turn on the macro recorder while you do it manually
(tools=Macros = Record a new macro, insert the picture, then click the
stop recording button, or if it is not visible Tools=Macros=Stop
Recording. Then you can examine the code recorded and generalize it if
necessary).

--
Regards,
Tom Ogilvy


"Jean" wrote in message
oups.com...
Hi,

I am relatively new at Excel VBA, but have used Access VBA in the past
and need a few tips to do the following seemingly simple task.

I have a spreadsheet, with a comand button cmdShowPic. When the user
clicks on cmdShowPic, it must show a picture that I specify.

My question is: how do I implement this? To start, do I simply copy and
paste the pic into the spreadsheet? And how do I caal a method that
will show the pic? I am not sure how to do this, maybe with a User
Form?

Thanks in advance for the help!

J