Spell Checking

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Spell Checking

Post by Don Wells »

I am running Office 2003 and would prefer a solution to my problem in Excel, but failing that, in Word.

Given a particular arrangement of letters, I want to determine whether or not a spelling error is detected (ideally a boolean function).

Although the following code checks the spelling, I can determine no technique to have the code return a boolean response to the question "Is there a spelling error?".

Code: Select all

    Cells(3,3).CheckSpelling SpellLang:=1033
Any guidance will be greatly appreciated.
Regards
Don

User avatar
StuartR
Administrator
Posts: 12605
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Spell Checking

Post by StuartR »

According to the help file in Excel 2010 Application.CheckSpelling(Word, CustomDictionary, IgnoreUppercase) returns a boolean value to show if a given word has a spelling error. Does this work in Excel 2003?
StuartR


User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Spell Checking

Post by HansV »

Stuart, it's the same in Excel 2003: see CheckSpelling Method [Excel 2003 VBA Language Reference].
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Spell Checking

Post by Don Wells »

Stuart and Hans
    Thank you both.
    Does anyone know of an Excel equivalent to:

Code: Select all

ActiveDocument.Range(Selection.Start, Selection.End).SpellingErrors.Count
:thankyou:
Regards
Don

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Spell Checking

Post by HansV »

Excel is not a word processing application. It has some basic spell checking features, but there is no built-in equivalent to the line you posted. You'd have to split cell contents into words, apply Application.CheckSpelling to each word in turn, and count the number of times it returns False.
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Spell Checking

Post by Don Wells »

Got it !
Thank you Hans :thankyou:
Regards
Don