Copy all misspelled words

R

rj

Hi All,

I have a large document (over 1000 pages) and want to copy all the
misspelled words and paste them in new document (1 below the other)
how can this be done? I am using Word 2003.

Thanks in advance :)
 
G

Greg Maxey

If you don't want to use the code in my weblink then a simple version
would be:

Sub ListErrorsAllowDups()
Dim oErr As Word.Range
Dim oCol As Collection
Dim i As Long
Set oCol = New Collection
For Each oErr In ActiveDocument.Range.SpellingErrors
oCol.Add oErr
Next
Documents.Add
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
End Sub

Sub ListErrorsNoDups()
Dim oErr As Word.Range
Dim oCol As Collection
Dim i As Long
Dim bDup As Boolean
Set oCol = New Collection
For Each oErr In ActiveDocument.Range.SpellingErrors
bDup = False
For i = 1 To oCol.Count
If oCol(i) = oErr Then bDup = True
Next i
If Not bDup Then oCol.Add oErr
Next
Documents.Add
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
End Sub
 
G

Greg Maxey

Karl,

I had come up with this earlier before I started exploring the class
method:

Sub ListErrorsNoDups()
Dim oErr As Word.Range
Dim oCol As Collection
Dim i As Long
Dim bDup As Boolean
Set oCol = New Collection
For Each oErr In ActiveDocument.Range.SpellingErrors
bDup = False
For i = 1 To oCol.Count
If oCol(i) = oErr Then bDup = True
Next i
If Not bDup Then oCol.Add oErr
Next
Documents.Add
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
End Sub

I like you method better.

Would you have anything that demonstrated this raise and sink events
idea that you mentioned?
 

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