Private Sub Text1_Change()If Len(Text1.Text) > 4 Then Text1.Text = Left(Text1.Text, 4)End Sub
将文本框的maxlength属性设置为4就行了
利用len(text1.txt)语句判断