holyFackel
holyFackel

Reputation: 71

Change tab order of some ActiveX and Form Controls

I have created some text-boxes (ActiveX Controls), checkboxes (Form Controls) and one end-button (Form Controls) in my Worksheet and wanted to tab between them.

How can I achieve that?

Maybe it's only possible with VBA.

Thank you very much in advance for your answers...

Upvotes: 0

Views: 1645

Answers (1)

Comintern
Comintern

Reputation: 22195

There isn't a way to do this via the properties (that I'm aware of), but you can always just use the KeyDown event, trap the tab key, and then use .Verb to set focus to where you want. For example, if you have a CheckBox, a ComboBox, and a TextBox:

Private Sub CheckBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = 9 Then
        ComboBox1.Verb
    End If
End Sub

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = 9 Then
        TextBox1.Verb
    End If
End Sub

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = 9 Then
        CheckBox1.Verb
    End If
End Sub

Upvotes: 1

Related Questions