| You simply pass the textbox and it returns the number of words in it. Inputs: USAGE--countWords(the textbox to check) 'EXAMPLE--countWords(text1) Public Function countWords(textBox As textBox) As Long Dim a As Integer, b As Integer, c As Integer, text As String text = Trim(textBox) If text = "" Then b = -1 For a = 1 To Len(text) If Asc(Mid(text, a, 1)) <> 13 Then If Mid(text, a, 1) <> " " Then c = 0 If Mid(text, a, 1) = " " Then c = c + 1 If c = 1 Then b = b + 1 Else a = a + 1 End If Next b = b + 1 countWords = b End Function |
Count number of words in a textbox |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design