Why doesn't Cancel (Escape key) work while Sleep API (kernel32.dll) is running?
I was looking at making a minor change to a solved thread (see http://www.excelforum.com/excel-prog...user-form.html )
I would like the user to be able to exit the form by pressing Escape. I altered the start and end of the sub to below but it didn't work:
START:
Private Sub UserForm_Activate()
On Error GoTo ErrHandler
Application.EnableCancelKey = xlErrorHandler
END:
ExitProcedure:
Unload Me
Exit Sub
ErrHandler:
Resume ExitProcedure
End Sub
Why doesn't this work?
Bookmarks