Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default How to show and hide a picture on a button at runtime?

Hi,

I want to have a piccture on a button and make it invisible and visible when
another button is clicked. I have put the picture on the button by copying
it and then selecting picture in the properties of the button (which is on a
userform) and then ctl v.

Any tips appreciated, thanks and regards, Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How to show and hide a picture on a button at runtime?

Assuming the button you want to have the picture on is named CommandButton1
and the name of the "other button" is CommandButton2... then use this
CommandButton2 Click event (replace my sample path to the picture with your
actual path to the picture in the LoadPicture function call)...

Private Sub CommandButton2_Click()
If CommandButton1.Picture = 0 Then
CommandButton1.Picture = LoadPicture("C:\Dir1\Dir2\Pic.bmp")
Else
CommandButton1.Picture = LoadPicture("")
End If
End Sub

--
Rick (MVP - Excel)


"Mark Stephens" wrote in message
...
Hi,

I want to have a piccture on a button and make it invisible and visible
when another button is clicked. I have put the picture on the button by
copying it and then selecting picture in the properties of the button
(which is on a userform) and then ctl v.

Any tips appreciated, thanks and regards, Mark


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default How to show and hide a picture on a button at runtime?

Thanks Rick, works really well:)

Mark



"Rick Rothstein" wrote in message
...
Assuming the button you want to have the picture on is named
CommandButton1 and the name of the "other button" is CommandButton2...
then use this CommandButton2 Click event (replace my sample path to the
picture with your actual path to the picture in the LoadPicture function
call)...

Private Sub CommandButton2_Click()
If CommandButton1.Picture = 0 Then
CommandButton1.Picture = LoadPicture("C:\Dir1\Dir2\Pic.bmp")
Else
CommandButton1.Picture = LoadPicture("")
End If
End Sub

--
Rick (MVP - Excel)


"Mark Stephens" wrote in message
...
Hi,

I want to have a piccture on a button and make it invisible and visible
when another button is clicked. I have put the picture on the button by
copying it and then selecting picture in the properties of the button
(which is on a userform) and then ctl v.

Any tips appreciated, thanks and regards, Mark




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button to show/hide a different worksheet Marilyn Excel Discussion (Misc queries) 1 April 22nd 09 03:37 AM
HOW TO HIDE/SHOW PICTURE AS PER LOGIC IS NOT DESCRIBED PROPERLY. Tushar Excel Programming 1 January 9th 09 02:35 PM
hide or show a series with a button Craig Charts and Charting in Excel 1 December 6th 07 04:36 AM
hide and show columns using one control button dreamkeeper Excel Programming 8 March 3rd 06 03:16 AM
show and hide a picture A-Design Excel Programming 1 December 3rd 05 08:14 PM


All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"