Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead of

Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users are
used to hitting enter to move to the next field. I only know of using tab to
move to the next one.
Is there a way to accomplish this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Userform - Move to next textbox field by hitting enter instead of

Tim,

Unfortunately, I have to develop for people who aren't familiar with windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to False,
using the enter button should advance to the next text box. However, this is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users are
used to hitting enter to move to the next field. I only know of using tab
to
move to the next one.
Is there a way to accomplish this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

....thank god I'm not alone.
Thanks for the insite and the chuckle.

"Mike Mertes" wrote:

Tim,

Unfortunately, I have to develop for people who aren't familiar with windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to False,
using the enter button should advance to the next text box. However, this is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users are
used to hitting enter to move to the next field. I only know of using tab
to
move to the next one.
Is there a way to accomplish this?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Userform - Move to next textbox field by hitting enter instead of

Hi Mike

I disagree 150%. In an Excel environment, where these users are expected to
come from, Enter completes a cell entry and jumps to the next cell. The
default "Windows Form" behavior is less relevant.

No, it does not require much code, it's done within 20 seconds. For each
textbox, copypaste this and change its name in the title:

Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub

And even if it did require hours of code; do it. Developers are there to
serve users, users are not there to serve developers. Anything improving the
user experience is worth doing.

Best wishes Harald

"Mike Mertes" skrev i melding
...
Tim,

Unfortunately, I have to develop for people who aren't familiar with

windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to

False,
using the enter button should advance to the next text box. However, this

is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're

more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that

too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make

me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users

are
used to hitting enter to move to the next field. I only know of using

tab
to
move to the next one.
Is there a way to accomplish this?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

Harald,
That sounds well and good but I have almost 50 or so fields, so I would need
to write that for each field?

"Harald Staff" wrote:

Hi Mike

I disagree 150%. In an Excel environment, where these users are expected to
come from, Enter completes a cell entry and jumps to the next cell. The
default "Windows Form" behavior is less relevant.

No, it does not require much code, it's done within 20 seconds. For each
textbox, copypaste this and change its name in the title:

Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub

And even if it did require hours of code; do it. Developers are there to
serve users, users are not there to serve developers. Anything improving the
user experience is worth doing.

Best wishes Harald

"Mike Mertes" skrev i melding
...
Tim,

Unfortunately, I have to develop for people who aren't familiar with

windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to

False,
using the enter button should advance to the next text box. However, this

is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're

more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that

too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make

me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users

are
used to hitting enter to move to the next field. I only know of using

tab
to
move to the next one.
Is there a way to accomplish this?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Userform - Move to next textbox field by hitting enter instead

The alternative (subclassing) requires at least two lines of individual code
for every box too, so it's about as simple as this gets. So yes, but also
no, not write, copy-paste it and replace each single "TextBox1" with each
unit's name. C'mon, once done it's done.

Best wishes Harald

"TimT" skrev i melding
...
Harald,
That sounds well and good but I have almost 50 or so fields, so I would

need
to write that for each field?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594

"Harald Staff" wrote:

Hi Mike

I disagree 150%. In an Excel environment, where these users are expected to
come from, Enter completes a cell entry and jumps to the next cell. The
default "Windows Form" behavior is less relevant.

No, it does not require much code, it's done within 20 seconds. For each
textbox, copypaste this and change its name in the title:

Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub

And even if it did require hours of code; do it. Developers are there to
serve users, users are not there to serve developers. Anything improving the
user experience is worth doing.

Best wishes Harald

"Mike Mertes" skrev i melding
...
Tim,

Unfortunately, I have to develop for people who aren't familiar with

windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to

False,
using the enter button should advance to the next text box. However, this

is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're

more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that

too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make

me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users

are
used to hitting enter to move to the next field. I only know of using

tab
to
move to the next one.
Is there a way to accomplish this?






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Userform - Move to next textbox field by hitting enter instead

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

Harald,
I just realized, I know what I needed to ask you...
Is there any way that I could simply pull up a list of all the
textboxes/objects on a particular form that I am working on?

example: if I'm replacing all the "Textbox_1"'s... that's about 83 of them
I have to do and even though I used a consistant naming convention I can't
remember them all.

Solution?

"Harald Staff" wrote:

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Userform - Move to next textbox field by hitting enter instead

OK, ok, ok, ok. I surrender.

Replace "Userform1" wit the name of your particular form and this little
etude will generate all the necessary code for you in the immediate window:

Sub test()
Dim C As MSForms.Control
For Each C In UserForm1.Controls
If TypeOf C Is MSForms.TextBox Then

Debug.Print "Private Sub " & C.Name & "_KeyDown(ByVal KeyCode As _"
Debug.Print "MSForms.ReturnInteger, ByVal Shift As Integer)"
Debug.Print "If KeyCode = 13 Then KeyCode = 9"
Debug.Print "End Sub"
Debug.Print ""

End If
Next
End Sub

HTH. Best wishes Harald

"TimT" skrev i melding
...
Harald,
I just realized, I know what I needed to ask you...
Is there any way that I could simply pull up a list of all the
textboxes/objects on a particular form that I am working on?

example: if I'm replacing all the "Textbox_1"'s... that's about 83 of
them
I have to do and even though I used a consistant naming convention I can't
remember them all.

Solution?

"Harald Staff" wrote:

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594








  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

Ya killin me bro.... I just finished.
But I still have 6 more forms to do and that will help me tremendeously
(friggin spelling..)
Thanks again!


"Harald Staff" wrote:

OK, ok, ok, ok. I surrender.

Replace "Userform1" wit the name of your particular form and this little
etude will generate all the necessary code for you in the immediate window:

Sub test()
Dim C As MSForms.Control
For Each C In UserForm1.Controls
If TypeOf C Is MSForms.TextBox Then

Debug.Print "Private Sub " & C.Name & "_KeyDown(ByVal KeyCode As _"
Debug.Print "MSForms.ReturnInteger, ByVal Shift As Integer)"
Debug.Print "If KeyCode = 13 Then KeyCode = 9"
Debug.Print "End Sub"
Debug.Print ""

End If
Next
End Sub

HTH. Best wishes Harald

"TimT" skrev i melding
...
Harald,
I just realized, I know what I needed to ask you...
Is there any way that I could simply pull up a list of all the
textboxes/objects on a particular form that I am working on?

example: if I'm replacing all the "Textbox_1"'s... that's about 83 of
them
I have to do and even though I used a consistant naming convention I can't
remember them all.

Solution?

"Harald Staff" wrote:

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594






  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Userform - Move to next textbox field by hitting enter instead

i just have a question here. how come i can hit enter to move between text
boxes on my form? i don't have any code, other than to limit number entry to
a couple of fields.
the EnterKeyBehavior is set to false, which means enter moves the focus to
the next object in the tab order.

now, when i get to a frame with checkboxes, enter does nothing and tab moves
to the next checkbox.

just wondering

--


Gary


"Harald Staff" wrote in message
...
OK, ok, ok, ok. I surrender.

Replace "Userform1" wit the name of your particular form and this little
etude will generate all the necessary code for you in the immediate
window:

Sub test()
Dim C As MSForms.Control
For Each C In UserForm1.Controls
If TypeOf C Is MSForms.TextBox Then

Debug.Print "Private Sub " & C.Name & "_KeyDown(ByVal KeyCode As _"
Debug.Print "MSForms.ReturnInteger, ByVal Shift As Integer)"
Debug.Print "If KeyCode = 13 Then KeyCode = 9"
Debug.Print "End Sub"
Debug.Print ""

End If
Next
End Sub

HTH. Best wishes Harald

"TimT" skrev i melding
...
Harald,
I just realized, I know what I needed to ask you...
Is there any way that I could simply pull up a list of all the
textboxes/objects on a particular form that I am working on?

example: if I'm replacing all the "Textbox_1"'s... that's about 83 of
them
I have to do and even though I used a consistant naming convention I
can't
remember them all.

Solution?

"Harald Staff" wrote:

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594







  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Userform - Move to next textbox field by hitting enter instead

Hi Gary

i just have a question here. how come i can hit enter to move between text
boxes on my form?


There is no commandbutton with Default=true on your form. Those hijack
Enter.

i don't have any code, other than to limit number entry to
a couple of fields.
the EnterKeyBehavior is set to false, which means enter moves the focus to
the next object in the tab order.


I believe it's there to prevent lineshifts in strings where those aren't
wanted. They might as well use the discarded Enters for something useful.
Just guessing.

now, when i get to a frame with checkboxes, enter does nothing and tab

moves
to the next checkbox.


Enter makes no meaning to most other objects, there is no lineshift in a
checkbox. You can write code for it in the same way, either to Tab on

Private Sub CheckBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub

or to toggle value

Private Sub CheckBox2_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then CheckBox2.Value = Not CheckBox2.Value
End Sub

or whatever you need

Private Sub CheckBox3_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call InstallLinux
End Sub

HTH. Best wishes Harald


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
move to the right after hitting enter using macros Santa Fe Al Excel Discussion (Misc queries) 2 November 18th 09 07:45 PM
Automatically move to adjacent cells without hitting Enter Doug Excel Discussion (Misc queries) 7 August 11th 09 07:14 PM
Hitting Enter to Move Cursor to the Next Entry Cell Cisnerax Excel Worksheet Functions 3 February 25th 06 11:04 AM
What does hitting Ctrl + Shift + Enter to enter a formula do??? Help a n00b out. qwopzxnm Excel Worksheet Functions 2 October 20th 05 09:06 PM
Cursor not to move when hitting the enter key Alex Martinez Excel Worksheet Functions 1 May 12th 05 05:40 AM


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