Show comment based on MultiPage_Mousemove

Fredrik1987

Board Regular
Joined
Nov 5, 2015
Messages
69
Hi again!

I'm trying to display comments if the mouse hovers over a control in a userform.
The events works fine, but I have no idea how to detect if the mouse hovers over a control in the page or simply "empty space".

Is it possible to return the control name in the active multipage?
I could emulate this by the x and y coordinates, but I'd prefer to avoid this.. :)
Some forums mention .ControlTipText, but I haven't figured out how to implement this properly...
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
From the overwhelming response, I'm guessing my question was a bit unclear (or stupid? :))
In short, is it possible for vba to detect if a mouse hovers over a form control?

Something like this?

Code:
Private Sub MyMultiPage_MouseMove(ByVal Index As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    '/if mouse hovers over Control then
    '/    Select Case Control.Name
    '/        Case Is = "TextBox1"
                '  Show comment for "TextBox1"
    '/        case is = "Label1"
                '   Show comment for "Label1"
    '/    End Select
    '/End If
End Sub

Alternatively, perhaps the simpler solution:

Code:
Private Sub MyMultiPage_MouseMove(ByVal Index As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Select Case X
    Case Is = xCoordinate
        If Y = ycoordinate Then
            '   Show control comment
        End If
End Select


End Sub
 
Upvote 0
A Multipage's MouseMove event (like a Frames or the Userforms) will not fire if the mouse moves over a control.

What you want could be done with a custom Class, but calling a MsgBox in response to a MouseMove would be a bad interface, every move of the mouse would stop everything while the user presses OK and then the mouse move again (another OK).

If the ControlTipText doesn't work and you need a custom box, I'd recommend making a Label visible/invisible rather than a MsgBox
 
Upvote 0
Thank you so much for your response!

I was hoping to use something similiar to ActiveCell.Comment (Should have been more precice in my post), but that seems to be the intent of .ControlTipText property :)

But again, thank you for responding!
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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