GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor (relative to the screen) are put into the variable passed as lpPoint. The function returns 0 if an error occured or 1 if it is successful.
Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long
Receives the x and y coordinates of the mouse cursor.
Dim coord As POINT_TYPE
Dim retval As Long
retval = GetCursorPos(coord)
Debug.Print "The mouse is at:"; coord.x; coord.y