I try to make some forms close by pressing 'Esc', using
Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 27 Then Unload Me
End Sub
But it does not work. Neither with KeyDown
or KeyUp
.
For some reason the subroutine is not executed (if instead of the If...
I put a msgbox
it does not appear either).
I'm using VBA in Microsoft Word 2003