Private Sub Text1_Change() If (Len(Text1.Text) = 5) Then Text1.Text = Text1.Text + vbCrLf Text1.SelStart = Len(Text1.Text)
End If End Sub
Option Explicit Dim i As IntegerPrivate Sub Form_Load() i = 1 End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If i > 4 Then SendKeys "{enter}" i = 0 Else i = i + 1 End If End Sub
Private Sub Text1_Change() If Text1.Text <> "" Then Dim a() As String a = Split(Text1.Text, vbCrLf) Debug.Print UBound(a) If Len(a(UBound(a))) > 5 Then SendKeys "~" End If End If End Sub有一点不好的就是,如果是修改前面的字就没反映了。 这个判断的是最后一行。
If (Len(Text1.Text) = 5) Then
Text1.Text = Text1.Text + vbCrLf
Text1.SelStart = Len(Text1.Text)
End If
End Sub
Dim i As IntegerPrivate Sub Form_Load()
i = 1
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If i > 4 Then
SendKeys "{enter}"
i = 0
Else
i = i + 1
End If
End Sub
If Text1.Text <> "" Then
Dim a() As String
a = Split(Text1.Text, vbCrLf)
Debug.Print UBound(a)
If Len(a(UBound(a))) > 5 Then
SendKeys "~"
End If
End If
End Sub有一点不好的就是,如果是修改前面的字就没反映了。
这个判断的是最后一行。