Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Hayfa Khan   on Aug 10 In MS Office Category.

  
Question Answered By: Amanda Carter   on Aug 10

Here is the updated VBA code to set  the ( TabIndex ) & ( TabStop ) just prior to
a UserForm being loaded in
Anyway a concept I now do on most UserForms, is to place all objects( TextBoxes
and Optionbuttons ) sequentially in numbered order inside a Frame
With this concept I can do the ( TabStop=FALSE ) on a Frame, so the none of the
objects inside the specfic frame aren't tabbed to
For example, in another Userform I have optionbuttons inside a frame I didn't
want to be tabbed to with the ( TabKey )
Then with the code below, most Userforms comes out perfect with the ( TabKey )
sequence in sequential order.


Application.ScreenUpdating = False
tabIdx = 0
Set myForm = UserForm10
For Each cCont In myForm.Controls
tabIdx = tabIdx + 1
'MsgBox ("TYPENAME: " & TypeName(cCont))
Select Case TypeName(cCont)
Case "Frame"
cCont.TabStop = True
cCont.TabIndex = tabIdx
Case "CommandButton"
cCont.TabStop = False
Case "OptionButton"
cCont.Value = False
cCont.TabStop = True
cCont.TabIndex = tabIdx
Case "ComboBox"
cCont.TabStop = False
Case "TextBox"
cCont.TabStop = True
cCont.TabIndex = tabIdx
Case "Label"
'nothing here
End Select
Next cCont
'UserForm10.Show

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to prevent (TabKey) going to a command button ? Or get search suggestion and latest updates.


Tagged: