Attribute VB_Name = "Module1" 'Created by Stavros Korokithakis Option Explicit 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) Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Public Const MOUSE_MOVED = &H1 Public Const MOUSEEVENTF_ABSOLUTE = &H8000 Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 Public Const MOUSEEVENTF_MIDDLEUP = &H40 Public Const MOUSEEVENTF_MOVE = &H1 Public Const MOUSEEVENTF_RIGHTDOWN = &H8 Public Const MOUSEEVENTF_RIGHTUP = &H10 Sub ClickIt(x As Long, y As Long, Btn As Integer) 'Call this with x,y being coordinates, and button the button ' '1 is Left button '2 is Middle Button '3 is Right Button SetCursorPos x, y Select Case Btn Case 1 mouse_event &H6, 0, 0, 3, 3 Case 2 mouse_event &H60, 0, 0, 3, 3 Case 3 mouse_event &H18, 0, 0, 3, 3 End Select End Sub