I used a chart to hold the image. Format Chart area Pattern > Fill effect > Picture.
Click the start point and then while still holding the mouse move to the end point and release the button. You should now have 2 sets of x,y values.
Private m_lngOutputRow As Long
Private Sub Chart_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
If Button = 1 Then
With Worksheets("Sheet1")
If Len(.Cells(.Rows.Count, 1)) = 0 Then
m_lngOutputRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
.Cells(m_lngOutputRow, 1) = x
.Cells(m_lngOutputRow, 2) = y
Else
MsgBox "Full up"
End If
End With
End If
End Sub
Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
If Button = 1 Then
With Worksheets("Sheet1")
.Cells(m_lngOutputRow, 3) = x
.Cells(m_lngOutputRow, 4) = y
End With
End If
End Sub
Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
If Button = 1 Then
With Worksheets("Sheet1")
.Cells(m_lngOutputRow, 3) = x
.Cells(m_lngOutputRow, 4) = y
End With
End If
End Sub
I guess the next part is relating the xy data to the actual picture.
Bookmarks