Greg Maxey said:
I suppose that you could use the spelling error collection.
Alphanumeric combinations are ignore if the
Option.IignoreMixedDigits is set to true:
Sub ScratchMacro()
Dim oSplErr As Range
Options.IgnoreMixedDigits = True
For Each oSplErr In ActiveDocument.SpellingErrors
MsgBox oSplErr
Next
End Sub
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
Well, here's what my program does-
I have a loop for each spelling error in the document. Then, it finds
the space preceding the word and deletes it, then it checks to see if
the newly formed word is actually a word. Then, if that's not a word,
it deletes the space preceding that newly formed word, and if that's
not a word, it goes back to it's original spelling error. When that
"Do while x = 1 to 2" i have another to go for spaces proceeding the
spelling error.
If it finds one it can fix, it highlights it a light grey, and then
moves on to the next spelling error.
Now, for this to work properly, i actually have to turn
Option.IgnoreMixedDigits to false. Here's why. I have a spelling
error, it deletes the space. Now, i have a set of numbers XXX and a
spelling error, no space seperating-
XXXSpellingerror If that option is set to true it doesnt recognize any
spelling error. I forsaw this and set up a check at the beginning of
the macro. If that option is set to true, it sets it to false and
resets to true at the end of the macro, if it's set to false, it
doesnt do anything and leaves it as false.
Here's why i need a check for non-letters. At the moment i'm doing a
simple "With Selection.Find" and i find [0-9\'\,\.\;], but, there
could actually be any number of non-alpha characters, and i would
rather just have a check to make sure the whole selection actually is
alpha characters.
I hope all this makes sense.