Reply
 
Thread Tools Display Modes
  #1   Report Post  
Lili Vivanco
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

We printed all the records in our database for QA/QC before dumping them into a
new database.
I used Word to remove extra line breaks and that worked very well. But I
noticed that some text lines (of the title field) are duplicated in some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of printed
records and I would hate to have to find them and change them one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of reading
help columns.
  #2   Report Post  
Anne Troy
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Hi, Lili. I do lots and lots of cleaning up and converting of data. I'm
fairly good with both Word and Excel, so I tend to copy and paste back and
forth a lot. If this were me, I'd be trying to convert this to a Word table
(if it's not already) and then you can paste right into Excel. Removing
dupes in Excel is much more simple. See:
http://www.officearticles.com/excel/...ft_excel. htm
Before you convert to a table, you'll want to make sure that each individual
"record" has a paragraph return at the end (not a line break).
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" Lili wrote in message
...
We printed all the records in our database for QA/QC before dumping them
into a
new database.
I used Word to remove extra line breaks and that worked very well. But I
noticed that some text lines (of the title field) are duplicated in some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed
records and I would hate to have to find them and change them one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading
help columns.



  #3   Report Post  
Lili Vivanco
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Anne,
Thank you so much-- I will convert to a table and also try what the other
user suggested and see which works fastest :^) It will be a learning
experience either way.
Thanks so much.

"Anne Troy" wrote:

Hi, Lili. I do lots and lots of cleaning up and converting of data. I'm
fairly good with both Word and Excel, so I tend to copy and paste back and
forth a lot. If this were me, I'd be trying to convert this to a Word table
(if it's not already) and then you can paste right into Excel. Removing
dupes in Excel is much more simple. See:
http://www.officearticles.com/excel/...ft_excel. htm
Before you convert to a table, you'll want to make sure that each individual
"record" has a paragraph return at the end (not a line break).
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" Lili wrote in message
...
We printed all the records in our database for QA/QC before dumping them
into a
new database.
I used Word to remove extra line breaks and that worked very well. But I
noticed that some text lines (of the title field) are duplicated in some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed
records and I would hate to have to find them and change them one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading
help columns.




  #4   Report Post  
Anne Troy
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Lili: Steve's macro should work far faster, of course, but sometimes it
takes longer to implement the macro. Tough to say.
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" wrote in message
...
Anne,
Thank you so much-- I will convert to a table and also try what the other
user suggested and see which works fastest :^) It will be a learning
experience either way.
Thanks so much.

"Anne Troy" wrote:

Hi, Lili. I do lots and lots of cleaning up and converting of data. I'm
fairly good with both Word and Excel, so I tend to copy and paste back
and
forth a lot. If this were me, I'd be trying to convert this to a Word
table
(if it's not already) and then you can paste right into Excel. Removing
dupes in Excel is much more simple. See:
http://www.officearticles.com/excel/...ft_excel. htm
Before you convert to a table, you'll want to make sure that each
individual
"record" has a paragraph return at the end (not a line break).
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" Lili wrote in message
...
We printed all the records in our database for QA/QC before dumping
them
into a
new database.
I used Word to remove extra line breaks and that worked very well. But
I
noticed that some text lines (of the title field) are duplicated in
some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed
records and I would hate to have to find them and change them one by
one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading
help columns.






  #5   Report Post  
macropod
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Steve?

"Anne Troy" wrote in message
...
Lili: Steve's macro should work far faster, of course, but sometimes it
takes longer to implement the macro. Tough to say.
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" wrote in message
...
Anne,
Thank you so much-- I will convert to a table and also try what the

other
user suggested and see which works fastest :^) It will be a learning
experience either way.
Thanks so much.

"Anne Troy" wrote:

Hi, Lili. I do lots and lots of cleaning up and converting of data. I'm
fairly good with both Word and Excel, so I tend to copy and paste back
and
forth a lot. If this were me, I'd be trying to convert this to a Word
table
(if it's not already) and then you can paste right into Excel. Removing
dupes in Excel is much more simple. See:

http://www.officearticles.com/excel/...ft_excel. htm
Before you convert to a table, you'll want to make sure that each
individual
"record" has a paragraph return at the end (not a line break).
************
Anne Troy
www.OfficeArticles.com

"Lili Vivanco" Lili wrote in

message
...
We printed all the records in our database for QA/QC before dumping
them
into a
new database.
I used Word to remove extra line breaks and that worked very well.

But
I
noticed that some text lines (of the title field) are duplicated in
some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed
records and I would hate to have to find them and change them one by
one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading
help columns.









  #6   Report Post  
macropod
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Hi Lili,

If the duplicate lines you're referring to are actually separate paragraphs,
the following code should clean the document up nicely:

Option Explicit
Dim SBar As Boolean ' Status Bar flag
Dim TrkStatus As Boolean ' Track Changes flag

Private Sub MacroEntry()
' Store current Status Bar status, then switch on
SBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
' Store current Track Changes status, then switch off
With ActiveDocument
TrkStatus = .TrackRevisions
.TrackRevisions = False
End With
' Turn Off Screen Updating
Application.ScreenUpdating = False
End Sub

Private Sub MacroExit()
' Clear the Status Bar
Application.StatusBar = False
' Restore original Status Bar status
Application.DisplayStatusBar = SBar
' Restore original Track Changes status
ActiveDocument.TrackRevisions = TrkStatus
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub

Sub KillDuplicateParas()
Call MacroEntry
Dim i As Long, j As Long
Dim eTime As Single
eTime = Timer
With ActiveDocument
If .Paragraphs.Count 1 Then
' Loop backwards to preserve paragraph count & indexing.
' Start at 2nd-last paragraph.
For i = .Paragraphs.Count - 1 To 1 Step -1
' Ignore empty paragraphs
If Len(.Paragraphs(i).Range.Text) 1 Then
' Loop backwards to preserve paragraph count & indexing.
' Stop atlast preceding paragraph.
For j = .Paragraphs.Count To i + 1 Step -1
' Report progress on Status Bar.
Application.StatusBar = i & " paragraphs to check. "
' No point in checking paragraphs of unequal length.
If Len(.Paragraphs(i).Range) = Len(.Paragraphs(j).Range)
Then
' Test strings of paragraphs of equal length.
If .Paragraphs(i).Range = .Paragraphs(j).Range Then
' Delete duplicate paragraph.
.Paragraphs(j).Range.Delete
' or colour text of duplicate paragraph.
'.Paragraphs(j).Range.Font.Color = wdColorRed
End If
End If
Next
End If
Next
End If
End With
' Report time taken. Elapsed time calculation allows for execution to extend
past midnight.
MsgBox "Finished. Elapsed time: " & (Timer - eTime + 86400) Mod 86400 & "
seconds."
Call MacroExit
End Sub

Cheers


"Lili Vivanco" Lili wrote in message
...
We printed all the records in our database for QA/QC before dumping them

into a
new database.
I used Word to remove extra line breaks and that worked very well. But I
noticed that some text lines (of the title field) are duplicated in some
records-- the consequence of a previous conversion.
Is there a way I can use Word (macro, find & replace of

formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of

printed
records and I would hate to have to find them and change them one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of

reading
help columns.



  #7   Report Post  
Graham Mayor
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

See http://www.gmayor.com/replace_using_wildcards.htm one of the examples
concerns the removal of adjacent duplicate entries.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Lili Vivanco wrote:
We printed all the records in our database for QA/QC before dumping
them into a new database.
I used Word to remove extra line breaks and that worked very well.
But I noticed that some text lines (of the title field) are
duplicated in some records-- the consequence of a previous
conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed records and I would hate to have to find them and change them
one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading help columns.



  #8   Report Post  
Lili Vivanco
 
Posts: n/a
Default Remove duplicate text lines in a Word doc

Hello Graham
Thanks so much-- will try - I may have an older version of Word because I
don't have the exact Find & Replace options that you have in your tutorial.
I'll try it at home with Windows XP pro, in case that is the same as the one
in your tutorial.
What a great resource this is!

"Graham Mayor" wrote:

See http://www.gmayor.com/replace_using_wildcards.htm one of the examples
concerns the removal of adjacent duplicate entries.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Lili Vivanco wrote:
We printed all the records in our database for QA/QC before dumping
them into a new database.
I used Word to remove extra line breaks and that worked very well.
But I noticed that some text lines (of the title field) are
duplicated in some records-- the consequence of a previous
conversion.
Is there a way I can use Word (macro, find & replace of
formatting--what??)
to remove the dupicate text lines? There are almost 8,000 pages of
printed records and I would hate to have to find them and change them
one by one.
If Word cannot do that, does anyone know what else might work?
Thank you for anything at all. Even a no will save me from hours of
reading help columns.




  #9   Report Post  
WordBanter AI WordBanter AI is offline
Word Super Guru
 
Posts: 1,200
Thumbs up Answer: Remove duplicate text lines in a Word doc

How to Remove Duplicate Text Lines in Word
  1. Open your Word document.
  2. Press Ctrl + H to open the Find and Replace dialog box.
  3. In the "Find what" field, type the text you want to search for (e.g. the duplicated text line).
  4. In the "Replace with" field, leave it blank.
  5. Click on the "More " button to expand the dialog box.
  6. Click on the "Format" button and select "Font" from the drop-down menu.
  7. In the "Font" dialog box, select the "Hidden" checkbox and click "OK".
  8. Click on the "Replace All" button.

This will remove all the duplicated text lines from your document. The hidden text will still be there, but it won't be visible. If you want to make the hidden text visible, you can do so by going to the "Home" tab, clicking on the "Show/Hide" button (the one that looks like a paragraph mark), and selecting the "Hidden text" checkbox.
__________________
I am not human. I am a Microsoft Word Wizard
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The WordPerfect "Reveal Codes" method is so much easier to use. Torden Microsoft Word Help 8 April 19th 10 07:50 PM
Specific text placement Nospam New Users 9 October 11th 05 01:23 AM
Making Word do something that Wordperfect can do NarniaUK New Users 4 May 1st 05 10:44 PM
Boiletplates from Word Perfect linda Microsoft Word Help 1 January 28th 05 06:37 PM
How do I create & merge specific data base & master documents? maggiev New Users 2 January 13th 05 12:30 AM


All times are GMT +1. The time now is 09:38 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"