G
gvm
I recorded the following macro to replace line breaks with spaces. However, I
want it to replace line breaks only in the text that was selected before
invoking the macro. The following code replaces all line breaks in the whole
document.
Also, what do I need to do to ensure the macro is available to any and every
Word document that is open on this computer please? TIA .... Greg
Here's the code:
Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
want it to replace line breaks only in the text that was selected before
invoking the macro. The following code replaces all line breaks in the whole
document.
Also, what do I need to do to ensure the macro is available to any and every
Word document that is open on this computer please? TIA .... Greg
Here's the code:
Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub