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? |
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? |
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? |
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? |
All times are GMT +1. The time now is 10:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com