View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Get points in a worksheet using mouse click

Rock,

Here is some code to get the cursor position, but I am not clear how you
will run it, as pressing a button moves the cursor.

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

Private Type POINTAPI
x As Long
y As Long
End Type

Sub test()
Dim pPosition As POINTAPI
Dim lReturn As Long

lReturn = GetCursorPos(pPosition)
MsgBox "Cursor position is:" & vbCrLf & _
"x co-ordinate: " & pPosition.x & vbCrLf & _
"y co-ordinate: " & pPosition.y

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Rock" wrote in message
om...
I am writing procedure in excel 2002 where I have imported a bitmap
image into a worksheet and I would like to digitize a few points (get
the x and y coordinates) when I click on the mouse.

I would like to press a macro button that would allow the user to
click on a lower left control point and an upper right control point
(points on the bmp that have known x and y values used for scaling)
and then draw a label control with corners through the control points.

I have searched the newsgroups, but have not seen how to do this.

Thanks for the help.

Rock