rajkavikumar
New Member
- Joined
- Oct 2, 2012
- Messages
- 20
Hello Guys,
I am working on different User forms and I am trying to get tab index of all controls available in user form some forms also have frames and I am creating generic function which will have form as argument But I am facing difficulties as some forms are having frames
I need proper tab index regardless of Frames
EX. 1 user form having 7 control in 4 frames as explained below :
frame 1 -> 2 control
frame 2 -> 1 control
frame 3 -> 3 control
frame 4 -> 1 control
I want all controls list with their ascending tab order
Control 7 -> tab index 1
control 3 - tab index 2
control 1 - tab index 3
control 2 - tab index 4
control 4 - tab index 5
control 5 - tab index 6
control 6 - tab index 7
but due to frames I am facing difficulty

I am having below code
I am working on different User forms and I am trying to get tab index of all controls available in user form some forms also have frames and I am creating generic function which will have form as argument But I am facing difficulties as some forms are having frames
I need proper tab index regardless of Frames
EX. 1 user form having 7 control in 4 frames as explained below :
frame 1 -> 2 control
frame 2 -> 1 control
frame 3 -> 3 control
frame 4 -> 1 control
I want all controls list with their ascending tab order
Control 7 -> tab index 1
control 3 - tab index 2
control 1 - tab index 3
control 2 - tab index 4
control 4 - tab index 5
control 5 - tab index 6
control 6 - tab index 7
but due to frames I am facing difficulty


I am having below code
Code:
Sub TAB_Index(oFrm As UserForm)Dim iCntr As Integer, ArrTab() As String, oControl As Control, oControl1 As Control
iCntr = 0
For Each oControl In oFrm.Controls
If oControl.Name <> "Frame_Logo" And InStr(1, oControl.Name, "Frame", vbTextCompare) > 0 Then
For Each oControl1 In oControl.Controls
ReDim Preserve ArrTab(1, iCntr)
ArrTab(iCntr) = oControl.Name & iCntr
iCntr = iCntr + 1
Next oControl1
End If
Next oControl
END SUB