VB Code:
  1. Dim str1 As String
  2. str1 = Text1.Text
  3. Do While InStr(str1, "  ") > 0
  4.     str1 = Replace(str1, "  ", " ")
  5. Loop
  6. 'To count no. of words
  7. MsgBox Len(str1) - Len(Replace(str1, " ", "")) + 1
  8.  
  9. 'To count no. of characters (with spaces)
  10. MsgBox Len(str1)
  11.  
  12. 'To count no. of characters (without spaces)
  13. MsgBox Len(Replace(str1, " ", ""))
  14.  
  15. 'To count no. of semi-colons or any other character
  16. MsgBox Len(str1) - Len(Replace(str1, ";", ""))