Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How to use ENTER in a TextBox in Excel 2007

Hi

I have created a Userform containing some OptionButtons, a TextBox, a OK and
a Cancel button.
I have created a Click behavior for the OK button where I check for which
OptionButtons a user have chosen or if any text is entered in the TextBox.
I would like to add a behavior for the TextBox where I can press ENTER and
it then runs the same macro as pressing the actual OK button.
At the moment when pressing ENTER in the TextBox it moves the focus to the
next object in the tab order.

Any ideas?

/Lasse
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default How to use ENTER in a TextBox in Excel 2007

Hi,
Use the textbox exit event macro.
Regards.
Daniel

Hi

I have created a Userform containing some OptionButtons, a TextBox, a OK and
a Cancel button.
I have created a Click behavior for the OK button where I check for which
OptionButtons a user have chosen or if any text is entered in the TextBox.
I would like to add a behavior for the TextBox where I can press ENTER and
it then runs the same macro as pressing the actual OK button.
At the moment when pressing ENTER in the TextBox it moves the focus to the
next object in the tab order.

Any ideas?

/Lasse



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default How to use ENTER in a TextBox in Excel 2007

Lasse

Set the OK button's Default property to True and it clicks on Enter.
(Likewise, set Cancel buttons Cancel property to true and it clicks on Esc.)

HTH. Best wishes Harald


"Lasse" wrote in message
...
Hi

I have created a Userform containing some OptionButtons, a TextBox, a OK
and
a Cancel button.
I have created a Click behavior for the OK button where I check for which
OptionButtons a user have chosen or if any text is entered in the TextBox.
I would like to add a behavior for the TextBox where I can press ENTER and
it then runs the same macro as pressing the actual OK button.
At the moment when pressing ENTER in the TextBox it moves the focus to the
next object in the tab order.

Any ideas?

/Lasse


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
Excel 2007 - Textbox Formatting Troubled User Excel Programming 0 September 22nd 08 02:16 PM
Office 2007 - Using "Enter" in textbox Wegar Excel Discussion (Misc queries) 3 June 6th 08 11:50 AM
Want Enter to put CR in Textbox (not just CTRL-Enter) roadkill Excel Programming 7 October 11th 07 10:26 PM
Can you Click the "Enter" key to go to the next line in a Textbox without Exiting the Textbox ? Corey Excel Programming 1 February 22nd 07 05:09 AM
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM


All times are GMT +1. The time now is 04:40 AM.

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"