June 16, 2005 at 7:27 am
I'm looking to generate some VBA in Excel that can send a mouse-right-click to a cell in a worksheet. I suppose this would be comparable to SendKeys?
Anybody know how to do this?
Thanks in advance,
Pete
June 16, 2005 at 8:04 am
This will do it for you. But you will have to set a reference ot the cell in excel before calling.
----------------------------------------------------------
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)
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Public Sub RightDown()
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
-------------------------------------------------------------
As a tip, always look for user32 library for any window related functions.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply