WordCount ⌒璸衡stringず计(ぃ琌じ计)

Private Function WordCount(Intext As String) As Integer
Dim I As Integer
Dim TmpStr() As String
Dim T As String
Dim counter As Integer
T = Replace(Intext, vbCrLf, " ")
TmpStr = Split(T, " ")
For I = 0 To UBound(TmpStr)
If TmpStr(I) <> "" Then WordCount = WordCount + 1
Next I
End Function

ㄏノ絛ㄒ非称Command1禟祘Α絏

Private Sub Command1_Click()
Dim T As String
T = "hello world"
MsgBox WordCount(T) '肚2
End Sub


