We become indebted to.

Right now I am fixing a simple quote system with VBA in excel.
(The person who created it has retired.)

If i press the Tab key when entering a character string, \ t and a tab will be inserted in the character string.
It's difficult to use, so I'd like to move it to the next focus part where I can input.
Would you please help me with what words I should google for?

How to disable

object.TabKeyBehavior = Boolean
Sets whether to allow tab characters in the edit area.

I understand, but I want to focus on the part that can be input next.

I'm sorry for the very basic thing
If i have any information above, I would appreciate it if you could comment.

[Addition because the explanation is insufficient]
On the page created by "MultiPage" in the VBA form
I want to move to the next item with Ctrl + tab.
(For example, Control Panel>Network and Internet
Internet options such as [General] and [Security] at the top
I want to implement it so that it can be moved with Ctrl + Tab. )

What words should I use to implement such behavior?
Are you sure I want to ask?

  • Answer # 1

    If there is a text box (TextBox1) on the first page of the multipage (MultiPage1), you can set the KeyDown event as follows. Set the KeyDown event to all text boxes like this. (MultiPage1.Value = 0 will select the first page.)

    Private Sub TextBox1_KeyDown (ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If Shift = 2 And KeyCode = vbKeyTab Then
            KeyCode = 0
            Me.MultiPage1.Value = 1
        End If
    End Sub

    If there are many text boxes on a multi-page, the same code will be written repeatedly, so if you use a class module to standardize events, you only need to write the event in one place.

    Insert the class module and name the object,exTextBoxTo
    Write the following code there.

    Option Explicit
    Private WithEvents TB As MSForms.TextBox
    Public Sub SetCtrl (new_ctrl As MSForms.TextBox)
      Set TB = new_ctrl
    End Sub
    Private Sub TB_KeyDown (ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If Shift = 2 And KeyCode = vbKeyTab Then'When Ctrl + Tab
            KeyCode = 0
            With TB.Parent.Parent'Parent of text box parent (Page) (MultiPage)
                If .Value = .Pages.Count --1 Then'If the last page
                    .Value = 0
                    .Value = .Value + 1
                End If
            End With
        End If
    End Sub

    User form module

    Option Explicit
    Private TBCol As Collection'exTextBox class storage collection
    Private Sub UserForm_Initialize ()
      Set TBCol = New Collection
      Dim myCtrl As Control
      Dim myObj As exTextBox
      For Each myCtrl In Me.Controls
        If TypeName (myCtrl) = "TextBox" And TypeName (myCtrl.Parent) = "Page" Then
          Set myObj = New exTextBox
          myObj.SetCtrl myCtrl
          TBCol.Add myObj
        End If
    End Sub

    that's all.

  • Answer # 2

    I don't know if it suits ma2hiro's intention, but I will attach an image.
    To move multi-page directly instead of [Ctrl] + [Page Up] keys
    Click the title to change the screen. Then in TextBox1 (TabeIndex [0])
    In the case of Textbox3 that you want to focus on next when the input is completed and the [Enter] key is pressed If you change the TabeIndex number of TextBox3 (TabeIndex [2]) to [1],
    The focus is on TextBox1 through TextBox3. What do you think.

  • Answer # 3

    Excuse me.

    Ctrl + PageUp, PageDown
    You can do it with, so I'll have you deal with it here for the time being ...

    But I feel that Ctrl + Tab is more compatible with Windows in MultiPage.
    If you know the means, what kind of phrase should you use?
    Please let me know.