MouseDown

<< Click to Display Table of Contents >>

 

MouseDown

MouseDown(Button, ShiftState, MouseX, MouseY)

Occurs when any mouse button is pressed on a Screen. Use the MouseDown event to determine specific actions when a user clicks a Screen. The parameters of this event are described on the next table.

Available parameters on the MouseDown event

Name

Description

Button

Shows the mouse button pressed. Possible values for this parameter are 1: The mouse button pressed is the left one, 2: The mouse button pressed is the right one, or 4: The mouse button pressed is the middle one

ShiftState

Shows the key pressed along with the mouse button. Possible values for this parameter are 4: SHIFT key, 8: CTRL key, or 12: CTRL + SHIFT keys

MouseX

Shows the X coordinate where the mouse button was clicked on a Screen

MouseY

Shows the Y coordinate where the mouse button was clicked on a Screen

 

Example:

Sub InitialScreen_MouseDown(Button, ShiftState, MouseX, MouseY)
  'Shows a message box with
  'the mouse pointer coordinates
  MsgBox "X Coordinate: " & MouseX & _
    vbNewLine & "Y Coordinate: " & MouseY
End Sub

Was this page useful?