Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using Tab-Stop in between textbox components

Hi everyone,

I want know that is there any way to change the active textbox using TAB.
There is no tabstop property on textbox component in excel.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Using Tab-Stop in between textbox components

ozulku_omer:

add this code to Thisworkbook
'Thisworkbook
Dim txtBoxes(1 To 4) As New Class1

Private Sub Workbook_Open()
Dim ctr As OLEObject
Dim iCount As Integer
For Each ctr In Sheet1.OLEObjects
If TypeName(ctr.Object) = "TextBox" Then
iCount = iCount + 1
Set txtBoxes(iCount).TxtGroup = ctr.Object
End If
Next ctr
End Sub

Add a Class module to your project and add this code to it.

Public WithEvents TxtGroup As MSForms.TextBox
Private Sub TxtGroup_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
If TxtGroup.Index < 4 Then 'From 4 again rebounds 1
Sheet1.OLEObjects(TxtGroup.Index + 1).Activate
Else
Sheet1.OLEObjects(1).Activate
End If
End If
End Sub


download:
http://www.vba.holyou.net/file/9411241.xls


--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"ozulku_omer" wrote:

Hi everyone,

I want know that is there any way to change the active textbox using TAB.
There is no tabstop property on textbox component in excel.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Using Tab-Stop in between textbox components

This is a textbox from the controls toolbox ? Placed on a worksheet, on a
userform or where ? Which version of Excel are you using ?

Best wishes Harald

"ozulku_omer" skrev i melding
...
Hi everyone,

I want know that is there any way to change the active textbox using TAB.
There is no tabstop property on textbox component in excel.

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using Tab-Stop in between textbox components

I got 9 textboxes. So am i change this code like that?
Dim txtBoxes(1 To 4) As New Class1
Dim txtBoxes(1 To 9) As New Class1
If TxtGroup.Index < 4 Then 'From 4 again rebounds 1
If TxtGroup.Index < 9 Then 'From 4 again rebounds 1


I have done all of them it but i doesn.t work like i wish. It focuses on
combobox object and stops when i hit the tab 3 times. The question is how can
i set the tabstop order. I mean my textboxs are in mixed order and i want to
focus on them in a fixed order. thanks a lot.


"chijanzen" wrote:

ozulku_omer:

add this code to Thisworkbook
'Thisworkbook
Dim txtBoxes(1 To 4) As New Class1

Private Sub Workbook_Open()
Dim ctr As OLEObject
Dim iCount As Integer
For Each ctr In Sheet1.OLEObjects
If TypeName(ctr.Object) = "TextBox" Then
iCount = iCount + 1
Set txtBoxes(iCount).TxtGroup = ctr.Object
End If
Next ctr
End Sub

Add a Class module to your project and add this code to it.

Public WithEvents TxtGroup As MSForms.TextBox
Private Sub TxtGroup_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
If TxtGroup.Index < 4 Then 'From 4 again rebounds 1
Sheet1.OLEObjects(TxtGroup.Index + 1).Activate
Else
Sheet1.OLEObjects(1).Activate
End If
End If
End Sub


download:
http://www.vba.holyou.net/file/9411241.xls


--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"ozulku_omer" wrote:

Hi everyone,

I want know that is there any way to change the active textbox using TAB.
There is no tabstop property on textbox component in excel.

Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using Tab-Stop in between textbox components

yes this is a textbox from controls toolbox placed on worksheet.XL 2003.

Thanks.

"Harald Staff" wrote:

This is a textbox from the controls toolbox ? Placed on a worksheet, on a
userform or where ? Which version of Excel are you using ?

Best wishes Harald

"ozulku_omer" skrev i melding
...
Hi everyone,

I want know that is there any way to change the active textbox using TAB.
There is no tabstop property on textbox component in excel.

Thanks.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Using Tab-Stop in between textbox components

You can subclass it as the other reply indicates. If you want it simpler
then add similar code for each box like this in the worksheet module:

Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 9 Then
If Shift = 1 Then
TextBox1.Activate
Else
TextBox3.Activate
End If
End If
End Sub

It's boring to write, but once done it's done.

HTH. Best wishes Harald

"ozulku_omer" skrev i melding
...
yes this is a textbox from controls toolbox placed on worksheet.XL 2003.

Thanks.

"Harald Staff" wrote:

This is a textbox from the controls toolbox ? Placed on a worksheet, on

a
userform or where ? Which version of Excel are you using ?

Best wishes Harald

"ozulku_omer" skrev i melding
...
Hi everyone,

I want know that is there any way to change the active textbox using

TAB.
There is no tabstop property on textbox component in excel.

Thanks.






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
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


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