Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Problem using tab in TextBoxes not in Userform

I've got six control Text boxes (TextBox1...TextBox6) they are NOT in a user
form. I want to be able to Tab between them and was trying to use the
following code, but found that it only worked for the first item and
thereafter I'd have to go in and "click" on the next text box to select it
before I could tab again to the next. Somehow the second use of the KeyDown
is not working as I thought.


Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

If KeyCode = 9 Then
TextBox2.Activate
End If
End Sub

Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

If KeyCode = 9 Then
TextBox3.Activate
End If
End Sub

....and so on.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default Problem using tab in TextBoxes not in Userform

I copied your code to a worksheet module then made a copy for textbox3
that activated Textbox1. On the worksheet I have 3 textboxes. It tabs
from 1 to 2 to 3 and back to 1, and then around again with no
problems. You have a pretty neat way of doing this that works fine
for me. I can simply tab through the boxes with or without entering
anything.

I am using Excel 2003.

Thanks

Ken



On Dec 3, 5:02*pm, Excel Curious
wrote:
I've got six control Text boxes (TextBox1...TextBox6) they are NOT in a user
form. I want to be able to Tab between them and was trying to use the
following code, but found that it only worked for the first item and
thereafter I'd have to go in and "click" on the next text box to select it
before I could tab again to the next. Somehow the second use of the KeyDown
is not working as I thought.

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

* * If KeyCode = 9 Then
* * * * TextBox2.Activate
* * End If
End Sub

Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

* * If KeyCode = 9 Then
* * * * TextBox3.Activate
* * End If
End Sub

...and so on.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Problem using tab in TextBoxes not in Userform

How are your properties set up with regards to tabs for each text box?

  #4   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default Problem using tab in TextBoxes not in Userform

On Dec 3, 6:33*pm, Excel Curious
wrote:
How are your properties set up with regards to tabs for each text box?


autoload false
autotab false
enabled true
enterfiedlbehavior 0
enterkeybehavior false
imimode 0
tabkeybahavior false

I don't know what they all do, but, these are the ones that look most
likely to be relevant.

Good luck

Ken
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Problem using tab in TextBoxes not in Userform

Yes, I can see that it works... now if I want to do the same thing in Word
will it work the same? I tried it and it doesen't. Any idea on how to adjust
the code or settings for a Word document?

Thank you for your help

"Ken" wrote:

On Dec 3, 6:33 pm, Excel Curious
wrote:
How are your properties set up with regards to tabs for each text box?


autoload false
autotab false
enabled true
enterfiedlbehavior 0
enterkeybehavior false
imimode 0
tabkeybahavior false

I don't know what they all do, but, these are the ones that look most
likely to be relevant.

Good luck

Ken



  #6   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default Problem using tab in TextBoxes not in Userform

It worked fine in Word for me.
Ken

On Dec 4, 5:14*pm, Excel Curious
wrote:
Yes, I can see that it works... now if I want to do the same thing in Word
will it work the same? I tried it and it doesen't. Any idea on how to adjust
the code or settings for a Word document?

Thank you for your help



"Ken" wrote:
On Dec 3, 6:33 pm, Excel Curious
wrote:
How are your properties set up with regards to tabs for each text box?


autoload * *false
autotab * * false
enabled * *true
enterfiedlbehavior *0
enterkeybehavior * false
imimode * *0
tabkeybahavior * *false


I don't know what they all do, but, these are the ones that look most
likely to be relevant.


Good luck


Ken- Hide quoted text -


- Show quoted text -


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
Userform and textboxes Paul Excel Programming 1 June 24th 08 11:21 AM
UserForm TextBoxes Rob Excel Discussion (Misc queries) 2 August 6th 05 03:07 AM
userform & textboxes beginner Excel Programming 3 July 27th 04 10:56 AM
userform textboxes again Jo[_6_] Excel Programming 4 October 21st 03 07:25 PM
userform textboxes Jo[_6_] Excel Programming 4 October 21st 03 07:15 PM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"