Set the form's KeyPreview property to True.
Code:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = (192) Then Debug.Print ("~")
End Sub
Printable View
Set the form's KeyPreview property to True.
Code:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = (192) Then Debug.Print ("~")
End Sub
what does keypreview do
KeyPreview Property - Returns or sets a value that determines whether keyboard events for forms are invoked before keyboard events for controls. The keyboard events are KeyDown, KeyUp, and KeyPress.
is there a way to do this with the mouse?
like: mousepreview?
Try this:
Code:Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(1) Then Debug.Print "Left mouse button"
If GetAsyncKeyState(2) Then Debug.Print "Right mouse button"
End Sub
cool, thanks