clicking on an image

  • Thread starter Thread starter Srikanth Ganesan
  • Start date Start date
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
 
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
 
Back
Top