素不相识716
幼苗
共回答了19个问题采纳率:89.5% 举报
Private Sub Command1_Click()
If Text1.Text = "" Then Exit Sub
Dim word As Variant,s As String
Dim k As Integer,maxw As String,n As Integer
s = Replace(Replace(Text1.Text,","," "),"."," ")
s = Replace(Replace(s,","," "),"."," ")
s = Replace(s,vbCrLf," ")
s = Trim(Replace(s," "," "))
If s = "" Then Exit Sub
word = Split(s," ")
n = UBound(word)
For k = 0 To n
If n = k Then Exit For
If Len(CStr(word(k + 1))) > Len(maxw) Then
maxw = word(k + 1)
End If
Next
MsgBox maxw & "=" & Len(maxw) & "字节"
End Su
1年前
追问
4
举报
素不相识716
哦,我看一下,就怕看别人代码 测试了,没有看到问题,你是在什么情况下有的提示错? 经过空测试,错误: 应该在 s = Text1.Text 下面判断: if s="" then exit sub