using For Each Next for replacing

A

Al

I have recorded a macro to do this but it is slow. Can someone please show
me how to do this with fast For Each Next;

Replace each Paragraph Mark Style xx with space space.


Also, replace all consecutive multiple paragraph marks with just one
paragraph mark.

Thanks.
 
H

Helmut Weber

Hi Al,
to get rid of all empty paragraphs,
which is not quite the same as¶

in case of an empty paragraph at the start of doc, e.g.,
or in case of an empty paragraph following a table
but might be what you are looking for
try this:
---
Dim oPrg As Paragraph
For Each oPrg In ActiveDocument.Paragraphs
If oPrg.Range = Chr(13) Then
oPrg.Range.Delete
End If
If oPrg.Range.Style = "00-bu-nc" Then ' paragraph format
oPrg.Range.Characters.Last = " "
End If
If oPrg.Range.Characters.Last.Font.Bold Then ' character format
oPrg.Range.Characters.Last = " "
End If
 
Top