K
KR
I'm unfamiliar with the word object model- I do all my VBA in Excel, but I'm
helping someone out with what should be a simple macro.
We are currently using [ActiveDocument.SpellingErrors.Count] which gives the
count of all the misspelled words in the document. however, if the user is
in the middle of typing a word (Inte when spelling Intelligent) then that
counts as a misspelled word when that line of code executes. So, we'd like
to adjust the range to count everything except the last word. Even better
would be to include all words if the cursor is not "in" a word, e.g. the
user types a space or a period or comma or anything that signifies that the
last word is complete.
I'm thinking the simple version, always excluding the last word would be
something like the following, but I don't know the syntax for Word well
enough to make it work, or to conditionally include or exclude that last
word.
Simple version (doesn't work):
myRng = ActiveDocument.SetRange(Start:=0,
End:=ActiveDocument.words.count-1)
ActiveDocument.myRng.SpellingErrors.Count
Thanks in advance for any help,
Keith
helping someone out with what should be a simple macro.
We are currently using [ActiveDocument.SpellingErrors.Count] which gives the
count of all the misspelled words in the document. however, if the user is
in the middle of typing a word (Inte when spelling Intelligent) then that
counts as a misspelled word when that line of code executes. So, we'd like
to adjust the range to count everything except the last word. Even better
would be to include all words if the cursor is not "in" a word, e.g. the
user types a space or a period or comma or anything that signifies that the
last word is complete.
I'm thinking the simple version, always excluding the last word would be
something like the following, but I don't know the syntax for Word well
enough to make it work, or to conditionally include or exclude that last
word.
Simple version (doesn't work):
myRng = ActiveDocument.SetRange(Start:=0,
End:=ActiveDocument.words.count-1)
ActiveDocument.myRng.SpellingErrors.Count
Thanks in advance for any help,
Keith