Private Declare Function GetAsyncKeyState _
Lib "user32.dll" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbLeftButton) Then Msgbox "Left button clicked"
If GetAsyncKeyState(vbMiddleButton) Then Msgbox "Middle button clicked"
If GetAsyncKeyState(vbRightButton) Then Msgbox "Right button clicked"
End Sub