Position of the mouse pointer

L

Liam

Hello all,

How would i get VB to report the position of the mouse pointer?

Thanks,
Liam :eek:)
 
G

Gary''s Student

Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long


Type POINTAPI
X As Long
Y As Long
End Type


Sub ShowPos()
Dim lRetVal As Long
Dim Pos As POINTAPI
lRetVal = GetCursorPos(Pos)
MsgBox Pos.X & ", " & Pos.Y
End Sub


The mouse doesn't even need to be in the application window.
 
J

John

Hi Gary,

Do you know of a good web source for details of calling Windows API
functions from VBA?

Best regards

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top