Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Get Mouse Coordinates

I want to position the mouse on the screen and press a shortcut key (like
Ctrl-d) to get the mouse coordinates. Thanks, James


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Get Mouse Coordinates

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


You can use the OnKey method to assign it to a shortcut combination or
select options in Tools=Macro=Macros after you select your macro.

--
Regards,
Tom Ogilvy


"Zone" wrote:

I want to position the mouse on the screen and press a shortcut key (like
Ctrl-d) to get the mouse coordinates. Thanks, James



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Get Mouse Coordinates

Tom, thank you very much. That's absolutely amazing! James
"Tom Ogilvy" wrote in message
...
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


You can use the OnKey method to assign it to a shortcut combination or
select options in Tools=Macro=Macros after you select your macro.

--
Regards,
Tom Ogilvy


"Zone" wrote:

I want to position the mouse on the screen and press a shortcut key (like
Ctrl-d) to get the mouse coordinates. Thanks, James





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Chart Coordinates with Mouse Events Jon Peltier Excel Programming 0 January 20th 07 11:43 PM
Mouse Coordinates J Streger Excel Programming 0 August 29th 06 03:08 PM
Mouse X-Y Coordinates Bob[_69_] Excel Programming 1 April 17th 06 04:32 AM
Can I grab graph coordinates in Excel via the mouse with VB? Chris Manning Charts and Charting in Excel 6 August 22nd 05 02:38 AM
Simple way to convert UTM ED50 coordinates to decimal coordinates? Dan[_38_] Excel Programming 8 July 11th 04 04:54 PM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"