May 16th, 2012, 11:43 AM
Interesting approach. I would simply use Split() to split the words into an array and use UBound() on the array (+1) to give you the word count.
Dim strSentence As String
Dim strWords() As String
Dim lngWordCount As Long
strSentence = "The quick brown fox jumped over the lazy dog."
strWords = Split(strSentence, " ")
lngWordCount = UBound(strWords) + 1 ' assumes zero bound array
MsgBox "Your sentence has " & lngWordCount & " words."
But it sounds like what you need for your question is to use the keypress event or key up/down event
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss