Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
move to the right after hitting enter using macros | Excel Discussion (Misc queries) | |||
Automatically move to adjacent cells without hitting Enter | Excel Discussion (Misc queries) | |||
Hitting Enter to Move Cursor to the Next Entry Cell | Excel Worksheet Functions | |||
What does hitting Ctrl + Shift + Enter to enter a formula do??? Help a n00b out. | Excel Worksheet Functions | |||
Cursor not to move when hitting the enter key | Excel Worksheet Functions |