PC Review


Reply
Thread Tools Rate Thread

Closing Form on pressing Enter or Return-key

 
 
eoleo.ftp@googlemail.com
Guest
Posts: n/a
 
      1st Oct 2007
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

 
Reply With Quote
 
 
 
 
Dave D-C
Guest
Posts: n/a
 
      3rd Oct 2007
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 =----
 
Reply With Quote
 
eoleo.ftp@googlemail.com
Guest
Posts: n/a
 
      11th Oct 2007
Thanks, works fine!

Leo

On 3 Okt., 21:14, Dave D-C <dacrom...@wyoming.kom> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where was I before pressing enter/return or tab key Fred Microsoft Excel Programming 1 25th Feb 2011 11:13 PM
closing form when pressing escape key =?Utf-8?B?S2hhbGVk?= Microsoft Excel Programming 1 20th Sep 2007 01:30 PM
How do i get figures for my maths. i am pressing enter return. =?Utf-8?B?bWFsX3dhcmRAaG90bWFpbC5jb20=?= Microsoft Excel Worksheet Functions 1 3rd Apr 2007 12:32 PM
Submit a form by pressing the enter key Chinnala Microsoft ASP .NET 3 10th Jan 2007 10:37 AM
OL2000 closing when replying and pressing enter key Jim Allard Microsoft Outlook 1 31st Oct 2003 08:48 PM


Features
 

Advertising
 

Newsgroups
 


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