This event occurs when a user presses a button on a mouse device.
Private Sub object_MouseDown(button, shift, x, y)
Use a event procedure to specify actions that occur when a user presses or releases a button of a mouse device. Unlike the Click and DblClick events, MouseDown events enable you to distinguish between the left and right buttons on a mouse device.
The following table shows the constants you can use to test for the button parameter.
Constant |
Value |
Description |
vbLeftButton | 1 | Left button is pressed. |
VbRightButton | 2 | Right button is pressed. |
VbMiddleButton | 4 | Unsupported. |
The following table shows the constants you can use to test for the shift parameter.
Constant |
Value |
Description |
vbShiftMask | 1 | SHIFT key is pressed. |
VbCtrlMask | 2 | CTRL key is pressed. |
VbAltMask | 4 | ALT key is pressed. |
You can use a MouseMove event procedure to respond to an event caused by moving the mouse device. The button parameter for MouseDown differs from the button parameter used for MouseMove. For MouseDown, the button parameter indicates exactly one button per event, whereas for MouseMove, the button parameter indicates the current state of all buttons.