This should be a pretty simple thing to do but I am having a problem getting a KeyPress event to work. What I want to do is have my code fire when the user presses the F10 button. I can get the code to work with other keys, just not the F10.
F10 doesn't generate a keyAscii code. Use the KeyDown Event:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF10 Then
' ... do something
KeyCode = 0 ' set to empty keypress
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 121 Then
MsgBox ("Begin Event!"
' call letsgo!
End If
' MsgBox KeyCode
End Sub
Similarly it would work with object_KeyDown I imagine. .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.