PDA

View Full Version : Solved: Convert text file paragraphs to line wrap



mikeburg
06-16-2006, 09:11 AM
I am converting my documents from Wordperfect 5.1 to MSWord 2002.

To do so, I am saving the Wordperfect documents as a text file then in MSWord opening them up.

When I select certain paragraphs, how can I convert the paragraphs from hard return to line wrap without having to delete at the end of each line?

Thanks so very much. mikeburg

mdmackillop
06-16-2006, 09:43 AM
Can you post a small sample of your text?

mikeburg
06-16-2006, 09:52 AM
Sure.

I, J. C. Bell, Jr., do hereby give the right to hunt on my property
located in Harrison County, Texas, for the period of time
commencing June 1, 2005, through July 31, 2006, to those listed
below and in their company. In no case will the bag limit as
defined in the current game regulations for Harrison County,
be exceeded by any of those listed or any persons accompanying
those listed.

Thanks, mikeburg

mdmackillop
06-16-2006, 09:56 AM
Sorry, but can you post it as an attachment as the "hard return" type is not discernable here. To post an attachment use Manage Attachments in the Go Advanced option.

mikeburg
06-16-2006, 11:52 AM
O. K., I am trying to attach it. Thanks, mikeburg

mdmackillop
06-16-2006, 12:29 PM
This will delete all paragraph marks unless preceded by a full stop.

Sub RemoveLineBreaks()
With Selection.Find
.Text = ".^p"
.Replacement.Text = "zzzz"
.Execute Replace:=wdReplaceAll
.Text = "^p"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
.Text = "zzzz"
.Replacement.Text = ".^p "
.Execute Replace:=wdReplaceAll
End With
End Sub

mikeburg
06-16-2006, 01:02 PM
I didn't realize I needed to use VBA, but this is great!
Thanks a million. mikdburg

lucas
06-16-2006, 01:29 PM
I kept them both(entire doc and selection) Malcolm...I could have used this a time or two...thanks

fumei
06-16-2006, 08:03 PM
Just to point out that the code runs from the Selection point forward. if the Selection point is not at the beginning of the document the whole document is not done. To be sure, put:Selection.HomeKey Unit:=wdStory at the start of the code.

lucas
06-17-2006, 08:06 AM
Thanks Gerry, I see your point