Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default UserForm Keyboard Control

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default UserForm Keyboard Control

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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default UserForm Keyboard Control

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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting control on userform with part of control name (set question) Keith Excel Programming 4 January 10th 07 02:24 PM
How do I reset my Control+A keyboard shortcut in Excel? EFXP Excel Discussion (Misc queries) 1 September 4th 06 05:58 AM
Passing scrollbar control to keyboard arrow keys Brad Excel Programming 0 March 13th 06 10:12 PM
Hide UserForm with Keyboard? bw Excel Programming 2 August 26th 05 10:37 PM
Why is pointer and keyboard control is lost in certain Excel file. MarkB3 Excel Discussion (Misc queries) 0 January 4th 05 07:15 PM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"