Este codigo mueve el mouse a las coordenadas 30,10 de la pantalla y le da doble click (en este caso es al icono 1 del escritorio)
Puede hacer que funcione en coordenadas dentro del formulario
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
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)
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Sub MoverMouse(x As Single, y As Single)
Dim pt As POINTAPI
pt.x = x
pt.y = y
' Estas 2 lineas hacen que se mueva pero solo dentro del formulario y quitando el ultimo SetCursorPos
'ClientToScreen hwnd, pt
'SetCursorPos pt.x, pt.y
SetCursorPos x, y
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command1_Click()
MoverMouse 30, 10
End Sub