MSForms cancel

T

Tritan

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
 
T

Tom Ogilvy

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
 

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