Blocking CTRL-F4


Hello Smart Folk,

Anyone got a code snippet that will stop my users being able to close a form with CTRL-F4?

Thanks,

M
LVL 3
MootherAsked:
Who is Participating?
 
Data-ManConnect With a Mentor COOCommented:
use the keydown event at the form level to check for the that cobination and then set the keycode to 0

Mike
0
 
MootherAuthor Commented:
any idea how to do that so my pc will understand it?

I know the principle..., but lack the talent...
0
 
Data-ManCOOCommented:
Put this code inside the keydown event for the form.

Also set the key preview property to yes.


If (Shift And acCtrlMask) > 0 And KeyCode = vbKeyF4 Then
    KeyCode = 0
End If

Mike
0
 
MootherAuthor Commented:
worth a A grade!!!

thanks a million!
0
 
Data-ManCOOCommented:
too bad it wasn't worth a million....LOL...Mike
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.