PDA

View Full Version : Implementing a Left Click using VBA



nsalyani
05-26-2011, 08:38 AM
Hi,

I am trying to implement a left click of the mouse on my PowerPoint Slide using VBA.

I managed to get the Right Click command working with the code below:

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

Unfortunately I am nowhere close to implementing the Left Click. COULD SOMEONE HELP PLEASE.

Thanks

nsalyani
05-26-2011, 11:08 AM
For all my VBA expertise in powerpoint, I couldn't think I got to change my Constants for a LEFT Click...duh-uh....

Thanks for whoever thought about this but I figured it out...my Const Variables for Right Click are H8 (Down) and H10 (Up) but for LEFT CLICK they should be H2 (Down) and H4(Up)

-Nsalyani