View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Esc key to exit form


Go to the properties of the close button on your form.
Set the Cancel property to true.

If the user presses escape.. the procedure attached to that
button is executed.
(see help on Msforms = Cancel property.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Huyeote wrote:


I have a form which has more than 20 controls on it. I want to enable
user to press Esc key to exit the form. I know I can use KeyUP or
KeyPress event of a single control to do it. But since there are two
many controls and it's messy and time consuming to code for each one of
them. Is there an easy way to acheive it?

Thanks

Huyeote