spelling-check

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
 
D

Dave Peterson

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.
 
D

Dana DeLouis

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
 

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

Top