View Single Post
  #7   Report Post  
JulieD
 
Posts: n/a
Default

Hi Charles

you're welcome - but here's version 2 .... the resulting list is now sorted
and duplicates removed
------
Sub print_sp_errors()

Dim TheArray() As String

Set myerrors = ActiveDocument.Range.SpellingErrors
If myerrors.Count = 0 Then
MsgBox "No spelling errors found."
Else
ReDim TheArray(myerrors.Count)

Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText "Spelling Errors"
Selection.TypeParagraph
i = 1
For Each myErr In myerrors
TheArray(i) = myErr
i = i + 1
Next
BubbleSort TheArray
For i = 1 To UBound(TheArray)
If Len(TheArray(i)) = 1 Then
Selection.TypeText TheArray(i)
Selection.TypeParagraph
End If
Next i


End If

End Sub

Function BubbleSort(TempArray As Variant)
'http://support.microsoft.com/kb/q213818/
Dim Temp As Variant
Dim i As Integer
Dim NoExchanges As Integer

' Loop until no more "exchanges" are made.
Do
NoExchanges = True

' Loop through each element in the array.
For i = 1 To UBound(TempArray) - 1

' If the element is greater than the element
' following it, exchange the two elements.
If TempArray(i) TempArray(i + 1) Then
NoExchanges = False
Temp = TempArray(i)
TempArray(i) = TempArray(i + 1)
TempArray(i + 1) = Temp
ElseIf TempArray(i) = TempArray(i + 1) Then 'added GD
TempArray(i) = "" 'added GD
End If
Next i
Loop While Not (NoExchanges)

End Function
-------

not sure if there's an easier way to sort arrays in Word, i pinched this
method from the web address listed which relates to Excel but seems to work
in my tests

Cheers
JulieD

"Charles Kenyon" wrote in
message ...
Ask and you shall receive!

Thank you.

I tested it in Word 2003 and it should be helpful. Might even be a proper
subject for a FAQ page on the MVP FAQ.

It repeated words, though. Don't know why, don't really care because it is
still much easier than going through and manually adding words to the
custom dictionary. I can take the list generated, sort it alphabetically,
cull out the duplicates, and add it to the custom dictionary relatively
easily.

Again, thank you.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"JulieD" wrote in message
...
Hi

here's a macro that will list your spelling errors at the end of the
document

----
Sub print_sp_errors()
Set myErrors = ActiveDocument.Range.SpellingErrors
If myErrors.Count = 0 Then
MsgBox "No spelling errors found."
Else
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText "Spelling Errors"
Selection.TypeParagraph
For Each myErr In myErrors
Selection.TypeText myErr.Text
Selection.TypeParagraph
Next
End If
End Sub
---

not sure of the code to automatically add the references to the custom
dictionary - maybe some else has an idea

Cheers
JulieD

"Charles Kenyon" wrote in
message ...
What would be handy would be a macro that would compile a separate list
of the spelling "errors" that could then be edited and added manually to
the custom dictionary. I wouldn't have a clue as to how to go about
writing such a macro, though.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

wrote in message
oups.com...
Hello,

When writing a Word Doc with many technical terms I find the process of
having to right click each red-underlined "mis-spelling" very time
consuming.

I click each one and either say "Add" or "Ignore All". I don't want to
turn off automatic spell checking for the entire document. If there a
way to highlight a bunch of text with spelling errors and "Add" them
all at once? Or is there a keyboard shortcut to add the most recently
red-underlined word?

Thanks.