
May 16th, 2012, 10:43 AM
|
 |
Type Cast Exception
|
|
Join Date: Apr 2004
Location: OAKLAND CA | Adam's Point (Fairyland)
|
|
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.
ie
Code:
Sub ExampleCount()
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."
End Sub
But it sounds like what you need for your question is to use the keypress event or key up/down event
__________________
medialint.com
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
|