PDA

View Full Version : VBA - MouseMove Event Code to Display Text after Hovering



sollijones
08-05-2013, 01:06 PM
Good Afternoon Forum Members! :hi:

I am new to VBA Express and am looking forward to learning a lot.

Here is my issue. I've added MouseMove code to CommandButtons in order to display text when a user hovers over the command button. However, I realized that now the user cannot actually click the button to perform the respective function. Please help! I've taken a VBA course many years ago, so basically I'm a complete novice. I am using Excel/VBA 2010.


This is a modification request to provide users the ability to mouse over a command button to view a description and also select/click the same command button to perform the related function.

Here is an example of the current code:

Private Sub CommandButton13_MouseMove(ByVal Button As Integer, ByVal Shift As Integer,


ByVal X As Single, ByVal Y As Single)
MsgBox "Validate Amounts "
End Sub

Many thanks in advance for your assistance, knowledge and expertise.

Simone

p45cal
08-05-2013, 02:10 PM
Is this command button on a sheet or a userform? If the latter it has a ControlTipText Property which pops up a box when you hover over the button which you can set to be descriptive of what the button does.
If it's on a sheet, come back.

Kenneth Hobs
08-05-2013, 02:20 PM
Welcome to the forum!

For a sheet's ActiveX CommandButton control, try something like this instead: http://www.mrexcel.com/forum/excel-questions/231930-mousemove-event-tooltip-over-commandbutton.html

I would use a short interval for the message.

sollijones
08-05-2013, 02:21 PM
Hi p45cal,

Thank you for your swift response! The command button is on a sheet. Please see the screenshot below.

10374

Many thanks.

sollijones
08-05-2013, 02:23 PM
Thanks Kenneth. I will take a look at the link.

p45cal
08-05-2013, 02:30 PM
The command button is on a sheet.Then perhaps Kenneth's suggestion will do it for you!