using escape key to exit a userform

H

heidi

hello all, and thanks in advance for any help on this.

i have a userform that is modal. the user's would like
to be able to hit "esc" to exit it, along with using the
Cancel button. is this a problem with a modal form?

some info on the form:
no button on the form has cancel set to true.
the cancel button and the standard "close" button work
fine.
the form has a listbox, three buttons, and an optionbox
group. only slecting is done on the form, no typing done
by the user.

for some reason, KeyDown is never activated on the form.
nor is the keypress event. i was going to use those to
capture if the user pressed the escape key.

i am using Excel XP.

thanks again!

heidi
 
D

Dick Kusleika

Heidi

some info on the form:
no button on the form has cancel set to true.
the cancel button and the standard "close" button work
fine.
the form has a listbox, three buttons, and an optionbox
group. only slecting is done on the form, no typing done
by the user.

Setting the Close or Cancel button's Cancel property to True should do just
that, regardless of the modality.
 
H

heidi

right you are!! now i feel silly!! i didn't even know
that is what that feature did.

thanks much!!
 

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