word search

S

Stewart

I have some very lengthy word 2007 documents and know that some of the
paragraphs and or chapters are duplicated. I know that I can find
duplicates with the "find"" option but that is quite slow.
Is there anyway that I can readily find whole chapters that are duplicated?
Thank you
 
G

Greg Maxey

I have some very lengthy word 2007 documents and know that some of the
paragraphs and or chapters are duplicated.  I know that I can find
duplicates with the "find"" option but that is quite slow.
Is there anyway that I can readily find whole chapters that are duplicated?
Thank you

How are you setting apart one chapter from the next or some subsequent
chapter that might be a duplicate?

As for deleting duplicate paragraphs then something like this might
work. Bear in mind that I didn't test this on War and Peace or
anything else of that magnitude, but it does delete duplicate
paragraphs (leave one original) in short documents.

Sub RemoveDuplicateParas()
Dim oPar As Paragraph
Dim myCol As New Collection
For Each oPar In ActiveDocument.Range.Paragraphs
On Error Resume Next
myCol.Add oPar.Range.Text, oPar.Range.Text
If Err.Number = 457 Then oPar.Range.Delete
On Error GoTo 0
Next
End Sub
 
S

Stewart

Over the last few years I have compiled 2 very long word documents and have
regularly added to them but am sure tht on occassions have repeated stuff
that was already there. If I had used a macro with headers then there would
not be a problem but I didn't.
I have one of them fully duplicated so shall try what you suggest in it.
Meantime I have been left clicking in margin of an early paragraph, pasting
into "find" and then searching for next. This works but is slow.
Thanks again


I have some very lengthy word 2007 documents and know that some of the
paragraphs and or chapters are duplicated. I know that I can find
duplicates with the "find"" option but that is quite slow.
Is there anyway that I can readily find whole chapters that are
duplicated?
Thank you

How are you setting apart one chapter from the next or some subsequent
chapter that might be a duplicate?

As for deleting duplicate paragraphs then something like this might
work. Bear in mind that I didn't test this on War and Peace or
anything else of that magnitude, but it does delete duplicate
paragraphs (leave one original) in short documents.

Sub RemoveDuplicateParas()
Dim oPar As Paragraph
Dim myCol As New Collection
For Each oPar In ActiveDocument.Range.Paragraphs
On Error Resume Next
myCol.Add oPar.Range.Text, oPar.Range.Text
If Err.Number = 457 Then oPar.Range.Delete
On Error GoTo 0
Next
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