spelling-check

  • Thread starter Thread starter Totmos
  • Start date Start date
T

Totmos

Is that possible to control the spelling-check or built-in lexicon (even
own) by VBA-code?
For example, in a text you have some words underlined red I would like VBA
to recognize the words and select them.

Grateful for any help
Totmos
 
There's nothing built into excel that supports that. Actually, if you're using
xl2002 and the words are the only value in the cell, you can Find (or replace)
based on formatting.

But if the word is in a cell with other words (formatted differently), then that
won't work.

I guess you could cycle through the usedrange looking through each cell and
looking at each character seeing if it matched your formatting requirements.

The select those cells.
 
Not sure what you want to do if you find a word misspelled. Would any ideas
here help?

Sub Demo()
Dim v
Dim j As Long
Dim WordOK As Boolean

[A1] = "This is spellled wrong"
v = Split(WorksheetFunction.Trim([A1]), Space(1))

For j = 0 To UBound(v)
WordOK = Application.CheckSpelling(v(j))
If Not WordOK Then
MsgBox "Wrong? " & v(j), vbInformation, "Address: " & [A1].Address
' Do stuff
End If
Next j
End Sub
 
Back
Top