Thread: MSForms cancel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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