在文本框中开始和结束选择 - VBA

Start and End Selection in textbox - VBA

如何确定文本框中文本的结束点selection? 例如:在 textbox1 中从 3 和 select 到 5 个字符开始。 0000000 (可以编辑 select 文本的选择。

Private Sub textbox1_change()
If TextBox1.TextLength = 7 Then
  With TextBox1
    .SetFocus
    .SelStart = 2
    .SelLength = Len(.Text)
  End With
End If
End Sub

在文本.SelLength = Len(.Text)中,插入.SelLength = 3.