clicking on an image

S

Srikanth Ganesan

Hello,
I am not sure if this is possible but I just want to know.
I am trying to write an excel macro with which I should be able to
insert an image (gray scale - gif) into a sheet and then comes the hard
part:
I should be able to move the mouse over the image and when I click on a
specific location on the image, I should get the pixel coordinates(X,Y)
stored in another sheet. I am basically trying to trace out some
specific features in the image files that I have. Please let me know how
to approach this problem. Thanks for your help.

Srikanth
 
I

Ivan F Moala

You could try using an Image control and loading up your image in this?
The use the image controls mousdown event to get your values

eg
Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift A
Integer, ByVal X As Single, ByVal Y As Single)
With Worksheets("Sheet2")
.Range("A65536").End(xlUp).Offset(1, 0) = X
.Range("B65536").End(xlUp).Offset(1, 0) = Y
End With
End Sub
 

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