A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Remove duplicate text lines in a Word doc



 
 
Thread Tools Display Modes
  #1  
Old October 27th 05, 12:13 AM
Lili Vivanco
external usenet poster
 
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.
Ads
  #2  
Old October 27th 05, 12:42 AM
Anne Troy
external usenet poster
 
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  
Old October 27th 05, 06:54 AM
Graham Mayor
external usenet poster
 
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.



  #4  
Old October 27th 05, 07:26 AM
macropod
external usenet poster
 
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.



  #5  
Old October 27th 05, 10:43 PM
Lili Vivanco
external usenet poster
 
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.




  #6  
Old October 27th 05, 10:46 PM
Lili Vivanco
external usenet poster
 
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.




  #7  
Old October 28th 05, 12:06 AM
Anne Troy
external usenet poster
 
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.






  #8  
Old October 28th 05, 09:12 AM
macropod
external usenet poster
 
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.







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
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 05:37 PM
How do I create & merge specific data base & master documents? maggiev New Users 2 January 12th 05 11:30 PM


All times are GMT +1. The time now is 03:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 2004-2014 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.