Disable Function Keys in VBA

  • Thread starter Thread starter Kassam
  • Start date Start date
K

Kassam

How do I disable a function key in VBA. For example, F7,
which always ends up with spell check even after executing
the code on 'key down' event.
Thanks
 
Set the Form's Key Preview property to True and put the following code
behind the OnKeyDown event.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF7 Then
KeyCode = 0
End If
End Sub

Ricky Hicks
 
Back
Top