Userform pop up on mouse hover

Qmustard

New Member
Joined
Sep 27, 2016
Messages
37
Hia ll,

Not sure how easy (and if its possible at all) this is, but I'd like to be able to hover over an image on a userform and have another userform pop up.
When you then move the mouse cursor away from the image, the userform it popped up then closes.

My current code is the following:

Code:
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Spare.Show
End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)S
pare.hide
End Sub

When I load the userform with the code in it, hovering over the image just closes causes the following:

Run-time error '402':
Must close or hide topmost modal form first


Which I interpret as Excel telling me it needs to close the first userform first.

I've tried using me.hide as well and this just hides the first userform.

Any suggestions or is this just not possible with an easy bit of code?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I have not tried it but when showing those, try using Show's vbModeless option. e.g.
Code:
Userform1.Show vbModeless
Spare.Show vbModeless
You will need to add move options so they don't overlap too much.
 
Upvote 0
Hmm, I tried putting that in the first part of the code and it still produces the same Run Time error.
 
Upvote 0

Forum statistics

Threads
1,214,959
Messages
6,122,476
Members
449,087
Latest member
RExcelSearch

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