Code:Dim vArray As Variant Dim intIndex As Integer Dim intCount As Integer Dim intWords As Integer ' Split the text into words. vArray = Split(Text1.Text, " ") ' Find those longer than 8 For intIndex = 0 To UBound(vArray) If Len(vArray(intIndex)) > 8 Then intCount = intCount + 1 End If If Trim(vArray(intIndex)) <> "" Then intWords = intWords + 1 End If Next MsgBox "Text1 contains " & intWords & " words " _ & "of which " & intCount & " are longer than 8 characters"




Reply With Quote