![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 06:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com