setting a range to check (was: Re: VBA count of mis-spelled words?)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Jonathan and Shauna-

Thank you for your reply- I'm usually in Excel VBA, and sometimes it takes a
whack with the obvious when I switch applications ;-)

Based on the spelling errors count (and some quick testing), it appears that
if the user is in the middle of typing a word when this code is fired, it
will count an extra error for the half-spelled word (unless the half
represents a different word in the dictionary).

I took a quick search using "range" as a keyword, but didn't see anything
that would easily explain how to switch the range from the whole document,
to everything minus the last word in the document (if this is even the best
approach?). I'll be doing this check without alerting or interrupting the
user, so I'd like to avoid having the range calculation affect the cursor
position in the document.

Many thanks,
Keith

"Jonathan West" <jwest@xxxxxxxx> wrote in message
news:%235gi0NcoGHA.3636@xxxxxxxxxxxxxxxxxxxxxxx

"KR" <nospam@xxxxxxxxxx> wrote in message
news:eiAEqHcoGHA.4960@xxxxxxxxxxxxxxxxxxxxxxx
How can I get a count of mis-spelled words in a document, using VBA?
Basically, the number of words with the red squiggly underline, although
related errors like mixed capitalization would also be of interest
especially if I could keep that count separate from the basic count of
mis-spelled words.

Thanks!


ActiveDocument.Range.SpellingErrors.Count returns the number of spelling
errors in the body of the document.

If you look up SpellingErrors in the VBA Help file, you will see what else
you might be able to do. For instance, the SpellingErrors object is a
collection of Range objects, so you can iterate through the collection and
get the text of each individual spelling error.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org



.



Relevant Pages

  • Re: Why VBA is a good programing language
    ... Jonathan, I don't disagree with anything you say here. ... VBA is not really at issue. ... > templates using SMS or login scripts. ... > thoroughly badly behaved applications like the Acrobat add-in. ...
    (microsoft.public.word.vba.customization)
  • Re: How is Paper Size set for a Printer using a Program?
    ... Thanks Jonathan. ... I went through to all your 4 parts on Controlling The Printer. ... I am not using VBA. ... > Controlling the Printer from Word VBA ...
    (microsoft.public.word.vba.general)
  • Re: Why VBA is a good programing language
    ... then VBA is a reasonable approach. ... you are missing one or other of these elements because there ... aren't all that many professional programmers who do Word for a living. ... Jonathan West - Word MVP ...
    (microsoft.public.word.vba.customization)
  • Re: Code executing too fast -- causes errors
    ... Jonathan, that do loop is a piece of nonsense. ... Using VBA to control Duplex, ...
    (microsoft.public.word.vba.beginners)
  • Re: WordBasic call CountMacros always returns 3
    ... Making the transition from WordBasic to VBA ... Useful WordBasic commands that have no VBA equivalent ... Microsoft website where you can download the Word 95 Wordbasic Help file. ... Jonathan West - Word MVP ...
    (microsoft.public.word.vba.general)