Found this code and i'm applying this to my idea of spot thr difference:
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _
ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Type POINTAPI 'Declare types
x As Long
y As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long 'Declare API
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Sub Main()
Dim z As POINTAPI 'Declare variable
Dim xpos As Long, ypos As Long
GetCursorPos z 'Get Coordinates
xpos = CLng(z.x)
ypos = CLng(z.y)
If ListVar1 = "Release" Then
Select Case ListVar2
Case "Left"
mouse_event MOUSEEVENTF_LEFTUP, xpos, ypos, cButt, dwEI
Case "Right"
mouse_event MOUSEEVENTF_RIGHTUP, xpos, ypos, cButt, dwEI
Case "Center", "Middle"
mouse_event MOUSEEVENTF_MIDDLEUP, xpos, ypos, cButt, dwEI
End Select
Else
Select Case ListVar2
Case "Left"
mouse_event MOUSEEVENTF_LEFTDOWN, xpos, ypos, cButt, dwEI
Case "Right"
mouse_event MOUSEEVENTF_RIGHTDOWN, xpos, ypos, cButt, dwEI
Case "Center", "Middle"
mouse_event MOUSEEVENTF_MIDDLEDOWN, xpos, ypos, cButt, dwEI
End Select
End If
End Sub
Sub Picture1_Click()
Dim z As POINTAPI 'Declare variable
Dim xpos As Long, ypos As Long
GetCursorPos z 'Get Coordinates
xpos = CLng(z.x)
ypos = CLng(z.y)
Range("Xaxis").Value = xpos
Range("Yaxis").Value = ypos
End Sub
HTH people
Bookmarks