ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Esc key to exit form (https://www.excelbanter.com/excel-programming/313201-esc-key-exit-form.html)

Huyeote[_6_]

Esc key to exit form
 

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

Thanks

Huyeot

--
Huyeot
-----------------------------------------------------------------------
Huyeote's Profile: http://www.excelforum.com/member.php...fo&userid=1389
View this thread: http://www.excelforum.com/showthread.php?threadid=26831


keepITcool

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. :confused: Is there an easy way to acheive it?

Thanks

Huyeote





All times are GMT +1. The time now is 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com