MouseMove Event - Microsoft Docs
MouseMove Event - Microsoft Docs
MouseMove event
11/15/2018 • 2 minutes to read •
In this article
Syntax
Settings
Remarks
See also
Syntax
For MultiPage, TabStrip
Private Subobject _MouseMove(indexAs Long,
ByValButtonAs fmButton,
ByValShiftAs fmShiftState,
ByValXAs Single,
ByValYAs Single)
Part Description
index Required. The index of the page or tab in a MultiPage or TabStrip associated with
this event.
Button Required. An integer value that identifies the state of the mouse buttons.
1 of 4 11/9/2020, 12:54 PM
MouseMove event | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/language/reference/user-inter...
Part Description
X, Y Required. The horizontal or vertical position, measured in points, from the left or
top edge of the control.
Settings
The index argument specifies which page or tab was clicked over. A - 1 designates that
the user did not click any of the pages or tabs.
Value Description
0 No button is pressed.
Value Description
2 of 4 11/9/2020, 12:54 PM
MouseMove event | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/language/reference/user-inter...
Value Description
You can identify individual keyboard modifiers by using the following constants:
Remarks
The MouseMove event applies to forms, controls on a form, and labels.
MouseMove events are generated continually as the mouse pointer moves across
objects. Unless another object has captured the mouse, an object recognizes a
MouseMove event whenever the mouse position is within its borders.
Moving a form can also generate a MouseMove event even if the mouse is stationary.
MouseMove events are generated when the form moves underneath the pointer. If a
macro or event procedure moves a form in response to a MouseMove event, the event
can continually generate (cascade) MouseMove events.
If two controls are very close together, and you move the mouse pointer quickly over
the space between them, the MouseMove event might not occur for that space. In such
cases, you might need to respond to the MouseMove event in both controls.
3 of 4 11/9/2020, 12:54 PM
MouseMove event | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/language/reference/user-inter...
You can use the value returned in the Button argument to identify the state of the
mouse buttons.
Use the Shift argument to identify the state of SHIFT, CTRL, and ALT when the
MouseMove event occurred. For example, if both CTRL and ALT are pressed, the value of
Shift is 6.
Note
You can use MouseDown and MouseUp event procedures to respond to events
caused by pressing and releasing mouse buttons.
See also
Microsoft Forms examples
Microsoft Forms reference
Microsoft Forms concepts
Yes No
4 of 4 11/9/2020, 12:54 PM