I am writing a program where I need to have the F5 key available for refreshing the screen. I don't want to put the option in a menu. I was wondering if there was a way to program the F5 to be received from the keyboard.
Thanks
Printable View
I am writing a program where I need to have the F5 key available for refreshing the screen. I don't want to put the option in a menu. I was wondering if there was a way to program the F5 to be received from the keyboard.
Thanks
This will work for a single form. If want something that is application wide you would need to use subclassing or system hooks.
Code:Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF5 Then
debug.print "F5 pressed"
End If
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub