A
andreas
Below code will remove trailing spaces from all paragraphs in the
current document, such as ...
sample text space space paragraph mark
Sub RmvTrSpPa()
With ActiveDocument.range.Find
..Format = False
..Text = "^w^p"
..Replacement.Text = "^p"
..Execute Replace:=wdReplaceAll
End With
I rewrote the macro to do the search and replace operation just in the
selected area, but I am getting a runtime error "5692" and .Execute
Replace gets highlighted Yellow . What's wrong with below code? Help
is appreciated. Thank you very much in advance.
Sub RmvTrSpPa_Selection()
'This will remove trailing spaces from all paragraphs in the selection
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Format = False
..Text = "^w^p"
..Replacement.Text = "^p"
..Execute Replace:=wdReplaceAll
End With
End Sub
current document, such as ...
sample text space space paragraph mark
Sub RmvTrSpPa()
With ActiveDocument.range.Find
..Format = False
..Text = "^w^p"
..Replacement.Text = "^p"
..Execute Replace:=wdReplaceAll
End With
I rewrote the macro to do the search and replace operation just in the
selected area, but I am getting a runtime error "5692" and .Execute
Replace gets highlighted Yellow . What's wrong with below code? Help
is appreciated. Thank you very much in advance.
Sub RmvTrSpPa_Selection()
'This will remove trailing spaces from all paragraphs in the selection
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Format = False
..Text = "^w^p"
..Replacement.Text = "^p"
..Execute Replace:=wdReplaceAll
End With
End Sub