Disable keys

  • Thread starter Thread starter Antonio
  • Start date Start date
A

Antonio

Good morning, all...I am trying to disable some keys, such
as the pg/up, pg/down, and ALT key.
I have the following code in the form/KEYDOWN procedure,
but it's not working. Any ideas?

'disabled 33 - PgUp key; 34 - PgDown key ; and the 18=Alt
key

Select Case KeyCode
Case vbKeyPageUp, vbKeyPageDown, 18
KeyCode = 0
MsgBox "Sorry! Page Up/Down and the ALT Keys
have been disabled.", vbInformation, _
"Disabled Keys"
Case Else
'Debug.Print KeyCode, Shift -- leave remarked
End Select
 
Have you changed the Key Preview property of the form to 'Yes'?

(Although it's a property, not an event, you'll find the Key Preview
property on the Events tab in the Properties window.)
 
Back
Top