Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Closing Form on pressing Enter or Return-key

Hallo,

in my UserForm I use a combobox that takes the focus, when the Form
opens. By using shortcut Ctl+D a dropdown is executed so the user is
able to select entries by using the arrow-keys.

Now I would like the programm to act as follows: If the user presses
the return or enter-key the form should close.
How can I reach that?

Thanks in advance.
Leo

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Closing Form on pressing Enter or Return-key

How about:
Private Sub ComboBox1_KeyDown( _
ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 13 Then UserForm1.Hide
End Sub

Did you do your shortcut with:
Private Sub ComboBox1_KeyPress( _
ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 4 Then UserForm1.ComboBox1.DropDown
End Sub ' ?
If not, how, please. Tnx D-C

eoleo wrote:
in my UserForm I use a combobox that takes the focus, when the Form
opens. By using shortcut Ctl+D a dropdown is executed so the user is
able to select entries by using the arrow-keys.

Now I would like the programm to act as follows: If the user presses
the return or enter-key the form should close.
How can I reach that?

Thanks in advance.
Leo



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Closing Form on pressing Enter or Return-key

Thanks, works fine!

Leo

On 3 Okt., 21:14, Dave D-C wrote:
How about:
Private Sub ComboBox1_KeyDown( _
ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 13 Then UserForm1.Hide
End Sub

Did you do your shortcut with:
Private Sub ComboBox1_KeyPress( _
ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 4 Then UserForm1.ComboBox1.DropDown
End Sub ' ?
If not, how, please. Tnx D-C

eoleo wrote:
in my UserForm I use a combobox that takes the focus, when the Form
opens. By using shortcut Ctl+D a dropdown is executed so the user is
able to select entries by using the arrow-keys.


Now I would like the programm to act as follows: If the user presses
the return or enter-key the form should close.
How can I reach that?


Thanks in advance.
Leo


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----http://www.newsfeeds.comThe #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



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
closing form when pressing escape key Khaled Excel Programming 1 September 20th 07 01:30 PM
How do i get figures for my maths. i am pressing enter return. [email protected] Excel Worksheet Functions 1 April 3rd 07 12:32 PM
WYA Converts to WAY after pressing enter ket Roger Cookson Excel Discussion (Misc queries) 3 December 16th 05 05:24 PM
Pressing Enter Key Yo Setting up and Configuration of Excel 4 October 28th 05 10:59 PM
Pressing Enter/Tab to go next question in a form Rachel Setting up and Configuration of Excel 4 October 3rd 05 11:16 PM


All times are GMT +1. The time now is 08:38 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"