我想做一个文本框text1.text
向里面输入数字,如果数字少于8位触发事件A, 如果=8位触发事件BPrivate Sub text1_Change()
这里怎么写????
End Sub

解决方案 »

  1.   

    select case len(text1)
    case <8
    执行a
    case 8
    执行b
    end select
      

  2.   

    Option ExplicitPrivate Sub Text1_Change()
       If Len(Text1.Text) > 8 Then
          Debug.Print "test'"
       Else
          Debug.Print "hello"
       End If
    End Sub狂汗,就这么简单嘛
      

  3.   

    Private Sub text1_Change()
       If Len(Text1.Text) = 8 Then
           Call Sub_B
       ElseIf Len(Text1.Text) < 8 Then
           Call Sub_A
       End If
    End Sub