Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
amberdevo
 
Posts: n/a
Default Join all lines at start of a word and end of a word

I have 5000 records which were saved as txt file from a webside. Who knows
why but with word2000 when I opened the file and removed line wrap all the
lines in a heading paragraph were joined together in one long string. This is
what I need to do so I can convert these records to MARC library cataloging
records. Now, with word 2003, removing line wrap does nothing. Most of the
document has the same format. I want to find for instance Title and select
all lines in that pararaph, then join all the lines on one continous line.
Example of format.

Title Joe Blow beat my fish then ran away with the cokies.
The police did nothing
Summary This video is a good example of how to beat a fish
and not get prosecuted
Copyright 1999

then the next record in the file

What I need to accomplish

Title Joe Blow beat my fish then ran away with the cokies.The police did
nothing
Summary This video is a good example of how to beat a fish and not get
prosecuted
Copyright 1999
  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor
 
Posts: n/a
Default Join all lines at start of a word and end of a word

Assuming all the records have exactly the same format then you can run four
wildcard replace routines to make the changes you require

^l(Title)
replace with
^p\1

^l(Summary)
replace with
^p\1

^l(Copyright)
replace with
^p\1

and

^l([!^l])
space\1

This assumes the line feed character is ^l
so first repace ^l3 with ^l to make it so

Thus

Sub FormatList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("^13", "^l(Title)", "^l(Summary)", "^l(Copyright)",
"^l([!^l])")
vReplText = Array("^l", "^p\1", "^p\1", "^p\1", " \1")
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Execute replace:=wdReplaceAll
Next i
End With
End Sub


--

Graham Mayor - Word MVP

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


amberdevo wrote:
I have 5000 records which were saved as txt file from a webside. Who
knows why but with word2000 when I opened the file and removed line
wrap all the lines in a heading paragraph were joined together in one
long string. This is what I need to do so I can convert these records
to MARC library cataloging records. Now, with word 2003, removing
line wrap does nothing. Most of the document has the same format. I
want to find for instance Title and select all lines in that
pararaph, then join all the lines on one continous line. Example of
format.

Title Joe Blow beat my fish then ran away with the cokies.
The police did nothing
Summary This video is a good example of how to beat a fish
and not get prosecuted
Copyright 1999

then the next record in the file

What I need to accomplish

Title Joe Blow beat my fish then ran away with the cokies.The police
did nothing
Summary This video is a good example of how to beat a fish and not
get prosecuted
Copyright 1999



Reply
Thread Tools
Display Modes

Posting Rules

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

Forum Jump


All times are GMT +1. The time now is 05:40 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"