Can a cursor cause a picture to change in a Userform?

Bill_Biggs

Well-known Member
Joined
Feb 6, 2007
Messages
1,216
Morning (here anyway),

I have a client who has poor eyesight. I have created a userform for him with several buttons on them. The buttons are pictures. I found some .gifs of buttons that change image when pressed but they don't work in Excel in a userform as far as I can tell. So what I want to do is put two pictures of the buttons on the form, a brighter one under the other. When the cursor passes over the two, the the dull picture will become invisible, leaving the brighter colored one visible. I think this is asking too much of 2003, but is anyone familiar with anything like this? I have some alternative ideas in mind (I have made the cursor and the userform very large), but I just wanted to check with the Collective here before I proceed. Thank you for the time.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You could have two images, one over the other, and set the brighter one's Visible property to False. Then use code like this for the userform and the other image:
Code:
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
   Image2.Visible = True
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
   If Me.Image2.Visible Then Me.Image2.Visible = False
End Sub
 
Upvote 0
Hey RoryA. I want to do something similar to this but not on a user form but just a plain excel worksheet. Also I tried following ur directions but failed at the first step of setting the visible property to false. This is sort of my first day with VB and I have no clue so can u please explain it in more detail and step by step.

Here's what I'm trying to do. I want to create a "button", which will basically be an image(faded). I want another image(unfaded) to appear on mouse over and when the mouse is not over it, I want it to revert back to original image(faded). Also is it possible to make more than one image appear on mouse over? bcuz I would also like another image to appear in a different cell, and revert back to original when the mouse is not over it. And by "button" I mean that when clicked it should go to a specified worksheet in the same workbook.

If the description above was confusing I can also provide u with the file. Let me know if u need to take a look at it.
 
Upvote 0
A worksheet doesn't have any mousemove events that you can trap. One possibility would be to add a second larger image control (it can be blank) underneath the one you want to use for the mouseover and use that control's mousemove event instead of the userform one.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top