Forum Discussion
Chandrakanth K
Jan 09, 2019Copper Contributor
Double click to open SAP Icon on Desktop
Hello All,
I am trying to Open SAP using Macro. I am trying to use Mouse control to double click on the SAP
I tried below code but still its not working.
Task is i need to double click on SAP Icon or any icon on the desktop.
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public 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)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN As Long = &H8
Public Const MOUSEEVENTF_RIGHTUP As Long = &H10
Private Sub RightClick()
SetCursorPos 200, 185
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
SetCursorPos 230, 195
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
Regards,
Chandrakanth.K
No RepliesBe the first to reply