ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   get cursor position when clicking on an image (https://www.excelbanter.com/excel-programming/354942-get-cursor-position-when-clicking-image.html)

timspier

get cursor position when clicking on an image
 

I want to be able to insert an image, say a jpeg or bmp, into a
worksheet. Then, I want to be able to click on a spot on that image and
have Excel record the X,Y coordinates where I clicked. I need to click
on several spots on an image and record the X,Y coordinates of each
spot, then determine the distance between spots. Any ideas?


--
timspier
------------------------------------------------------------------------
timspier's Profile: http://www.excelforum.com/member.php...o&userid=32090
View this thread: http://www.excelforum.com/showthread...hreadid=518452


NickHK

get cursor position when clicking on an image
 
timspier,
Whilst you could assign a macro to the picture, you would somehow have to
translate the current mouse coordinates into those relative to picture.

Images on worksheets don't have events, but the image control does. You get
the coordinates in the Image1_MouseDown event.
Set it to .Autosize=true, so no blank space.

NickHK

"timspier" wrote in
message ...

I want to be able to insert an image, say a jpeg or bmp, into a
worksheet. Then, I want to be able to click on a spot on that image and
have Excel record the X,Y coordinates where I clicked. I need to click
on several spots on an image and record the X,Y coordinates of each
spot, then determine the distance between spots. Any ideas?


--
timspier
------------------------------------------------------------------------
timspier's Profile:

http://www.excelforum.com/member.php...o&userid=32090
View this thread: http://www.excelforum.com/showthread...hreadid=518452




timspier[_2_]

get cursor position when clicking on an image
 

Hey, great idea! I looked into this, looks like it might work. Thanks!


--
timspier
------------------------------------------------------------------------
timspier's Profile: http://www.excelforum.com/member.php...o&userid=32090
View this thread: http://www.excelforum.com/showthread...hreadid=518452



All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com