ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Supressing SpellChecker dialogbox (https://www.excelbanter.com/excel-programming/343686-supressing-spellchecker-dialogbox.html)

davidm

Supressing SpellChecker dialogbox
 

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

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=47882


Jim Rech

Supressing SpellChecker dialogbox
 
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
"davidm" wrote in
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...o&userid=20645
| View this thread: http://www.excelforum.com/showthread...hreadid=478828
|



davidm

Supressing SpellChecker dialogbox
 

Thanks Jim, you've made my day.

David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=478828



All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com