J. P. Gilliver (John) said:
In message <
[email protected]>, BillW50 <
[email protected]>
writes:
[]
Take a simple task like some plain text contains ASC(13) after each
line. I often strip them off and use only one per paragraph. I can use
virtually any word processor (even one that I never used before) and
figure out how to do this in a matter of seconds.
How would you do it in Word? I'm assuming you mean you have a way of
deleting all the newlines at once, not manually - except presumably
double ones.
Under Word, I created this macro. And I run the macro by smacking ALT-1.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub RebuildLines()
'
' Removes hard returns from line ends unless
' paragraphs seperated by double returns.
' Check that some text is selected. This prevents
' macro from running from insertion point to end
' of document - which may screw up single spaced
' signatures, etc.
If Selection.Range = "" Then ' Nothing selected
MsgBox "No Text Selected", vbCritical
Exit Sub ' So QUIT
End If
' Must be at least some text selected so continue
' Note: if it doesn't include at least one paragraph
' mark nothing will happen!
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "~"
.Wrap = wdFindStop
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "~~"
.Replacement.Text = "^p^p"
.Wrap = wdFindStop
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "~"
.Replacement.Text = " "
.Wrap = wdFindStop
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Wrap = wdFindStop
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
.Wrap = wdFindStop
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Without macro ability, one could use find and replace. And most find and
replace, searching for ^p generally works even in Word (but not in
LibreOffice). And you must hit replace on every line until the end of
the paragraph. If you want to do another paragraph, you hit find until
it is time to start replacing once again.