How do I assign a function key to a command button

  • Thread starter Thread starter Randy
  • Start date Start date
I have a button on my form. I would like e.g. F5 to be the
key that activates the on-click event.

I am creating a small application that will run on a wall
mounted screen with only F-keys available.
 
Randy,

I think one way would be to use the KeyDown event. I haven't tested
this, but something like this...

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF5 Then
KeyCode = 0
Call YourButton_Click
End If
End Sub
 
Back
Top