If InStr(1, Text, " n.") <> 0 Then
        a = Split(Text, " n.")
        Text1 = a(0)
        Text2 = a(1)如何才能使a = Split(Text, " n.")
        Text1 = a(0)
        Text2 = a(1)
这三行在条件符合使才执行,现在是        Text1 = a(0)       Text2 = a(1)两行无论条件是否为真都执行

解决方案 »

  1.   

    Option ExplicitPrivate Sub Command1_Click()
            Dim a() As String
            If InStr(1, Text1.Text, "n.") > 0 Then
               a() = Split(Text1.Text, "n.")
               Text2.Text = a(0)
               Text3.Text = a(1)
            End IfEnd SubPrivate Sub Form_Load()
            Text1.Text = "sdvsdfv n. sdfgsdfg n. "
    End Sub
      

  2.   

    If InStr(1, Text, " n.")  <> 0 Then 
            a = Split(Text, " n.") 
            Text1 = a(0) 
            Text2 = a(1) 
    end if
      

  3.   

    If InStr(1, Text, " n.")   <> 0 Then  
            a = Split(Text, " n.") 
            Text1 = a(0)  :
            Text2 = a(1)  
    end if
      

  4.   

    If InStr(1, Text, " n.")  <> 0 Then 
            a = Split(Text, " n.") 
            Text1 = a(0) 
            Text2 = a(1) 
    end if