Disable keys

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
 
B

Brendan Reynolds

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top