MouseOver in VBA?

philhowell

Board Regular
Joined
Jun 11, 2002
Messages
175
I'm trying to replicate the Office XP mouse over effect on text boxes, but the VBA only allows me use mouseMove.... so is there a way to do onMouseOver and onMouseOut....

Something similar to the Javascript functions

Cheers
Phil

:o
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi Phil,

Say you have 2 textboxes and you want them to turn green when the mouse hovers over them. You'd use something like this:-

Code:
Private Sub Text0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text0.BackColor = vbGreen
End Sub

Private Sub Text2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text2.BackColor = vbGreen
End Sub

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text0.BackColor = vbWhite
Text2.BackColor = vbWhite
End Sub

This is not quite the same as the OnMouseOver event you mentioned in Javascript because you need a third procedure when the mouse moves over the form to set the textboxes back to white.

Hope that helps - post back if not.

Regards,
Dan
 
Upvote 0

Forum statistics

Threads
1,223,431
Messages
6,172,086
Members
452,444
Latest member
ShaImran193

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