ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MSForms cancel (https://www.excelbanter.com/excel-programming/271944-msforms-cancel.html)

Tritan

MSForms cancel
 
I'm trying to check when the esc key is hit on an MSForm
in Excel. I used to do a lot of VB programming a long
time ago with VB 2 & 3 I thought that all I had to do was
check the value of keypress for the form. But I must be
missing something.

Does anyone have a quick snipet that checks to see if the
esc key was pressed and calls the terminate or a close
method for the form?

Thanks.
Tritan

Tom Ogilvy

MSForms cancel
 
You can set the cancel property of a commandbutton to True and if escape is
pressed, the click event for that button will fire.

Regards,
Tom Ogilvy


"Tritan" wrote in message
...
I'm trying to check when the esc key is hit on an MSForm
in Excel. I used to do a lot of VB programming a long
time ago with VB 2 & 3 I thought that all I had to do was
check the value of keypress for the form. But I must be
missing something.

Does anyone have a quick snipet that checks to see if the
esc key was pressed and calls the terminate or a close
method for the form?

Thanks.
Tritan





All times are GMT +1. The time now is 09:41 AM.

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