Supressing SpellChecker dialogbox

  • Thread starter Thread starter davidm
  • Start date Start date
D

davidm

I need the right syntax to* prevent* the Spell Check dialog from showin
when it otherwise would upon encountering a wrong word. In suc
instance, I will rather prefer (to meet a special need ) to have a
Msgbox displayed simply indicating there is a "problem". I tried th
following code and failed, with the Speller dialog popping up each tim
... in spite of negating DisplayAlerts.

Sub SuppressSpeller()

Application.DisplayAlerts=False
x= Cells.CheckSpelling
If x =True then Msgbox "Spell error"
Application.DisplayAlerts=False

End Sub

TIA

Davi
 
There are several forms of the CheckSpelling method. The Application form
does not display the dialog but has to be given the actual text you want
checked, rather than the range you want checked:

?application.CheckSpelling("the cat has a hat")
True
?application.CheckSpelling("the cat has a kat")
False

So you'd have to write code to pull the range's text into a variable, maybe
a cell at a time, and then use that variable with CheckSpelling.

Sub Example()
Dim Cell As Range
For Each Cell In Range("A1:A10").SpecialCells( _
xlCellTypeConstants, xlTextValues)
If Application.CheckSpelling(Cell.Value) = False Then
MsgBox "Error in cell " & Cell.Address
End If
Next
End Sub


--
Jim
message |
| I need the right syntax to* prevent* the Spell Check dialog from showing
| when it otherwise would upon encountering a wrong word. In such
| instance, I will rather prefer (to meet a special need ) to have a
| Msgbox displayed simply indicating there is a "problem". I tried the
| following code and failed, with the Speller dialog popping up each time
| .. in spite of negating DisplayAlerts.
|
| Sub SuppressSpeller()
|
| Application.DisplayAlerts=False
| x= Cells.CheckSpelling
| If x =True then Msgbox "Spell error"
| Application.DisplayAlerts=False
|
| End Sub
|
| TIA
|
| David
|
|
| --
| davidm
| ------------------------------------------------------------------------
| davidm's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=20645
| View this thread: http://www.excelforum.com/showthread.php?threadid=478828
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top