View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default UserForm Keyboard Control

You would "trap" the red X by using, depending on your needs, either the
QueryClose or Terminate event procedures for the UserForm (in the UserForm's
code window, select UserForm from the left-hand drop down and QueryClose or
Terminate from the right-hand drop down). The QueryClose event gives you the
ability to cancel the closing of the UserForm if desired via its Cancel
argument.

--
Rick (MVP - Excel)


"DoctorG" wrote in message
...
Hi Rick!

Thanks for the feedback.

Can you tell me how to trap the red "X" on the top-right corner of the
form?
Is it the same as the default Cancel key?

"Rick Rothstein" wrote:

For the CommandButton that you want "clicked" when the Enter key is
pressed... set its Default property to True.

For the CommandButton that you want "clicked" when the Esc key is
pressed...
set its Cancel property to True.

--
Rick (MVP - Excel)


"DoctorG" wrote in message
...
I am new in Forms design. Can anyone tell me how to activate or specify
the
use of Enter and Esc keys in a form so that they represent a positive
and
a
negative user choice?