View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
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.