Show Picture When Hover Over A Label

raymond30031

New Member
Joined
Jan 19, 2011
Messages
20
Hello,

I have labels with different names and I hope to attach pictures to them for people to understand better what those names mean.

When the user hover the mouse over the label a picture will pop, and the picture will disappear when the mouse leave the label.

Here is what I have, The picture does show up, but I do not know how to make the picture disappear when the mouse leaves the label.

I have thought of using delay to display the picture for 5 secs and change visible to false, but i am just wondering if there is a way to code this to the way I hope.

Code:
Private Sub Label10_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Sheet2.Shapes("Picture 5").Visible = True
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try something like this:-
You may need to play with the "5" to get it to appear and disappear within the Label Area.
Code:
Private [COLOR="Navy"]Sub[/COLOR] Label1_MouseMove(ByVal Button [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] ByVal Shift [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] ByVal X [COLOR="Navy"]As[/COLOR] Single, ByVal Y [COLOR="Navy"]As[/COLOR] Single)
[COLOR="Navy"]If[/COLOR] X > 5 And X < Label1.Width - 5 And Y > 5 And Y < Label1.Height - 5 [COLOR="Navy"]Then[/COLOR]
    ActiveSheet.Shapes("Picture 1").Visible = True
[COLOR="Navy"]Else[/COLOR]
    ActiveSheet.Shapes("Picture 1").Visible = False
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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