Counter for deleting redundant paragraph marks in footnotes

A

andreas

Dear Experts:

below macro deletes all redundant paragraph marks in the footnote
section of a document (the user has forced unnecessary line breaks by
pressing ENTER at the end of a line and not let Word do the automatic
line break). The counter in this macro only counts the number of
footnotes where these redundant paragraph marks have been entered, not
the number of redundant paragraph marks themselves. Is it possible to
count the number of redundant paragraph marks or maybe even both, such
as:

"10 footnotes have been searched and 40 redundant paragraph marks have
been replaced in the footnotes!"

Help is much appreciated. Thank you very much in advance.

Regards, Andreas




Sub Replace_Redundant_ParagraphMarks_With_A_Space

Dim rng as range
Dim FTNT as Footnote


For Each FTNT In ActiveDocument.Footnotes


Set rng = FTNT.Range


With rng.Find
.Text = "^p"
.MatchWildcards = False
.Replacement.Text = " "
While .Execute(Replace:=wdReplaceAll)
i = i + 1
Wend
End With
Next
If i > 0 Then
MsgBox "Redundant pargraph marks have been set in " & i & "
footnotes. They have all been replaced with a space."
Else
MsgBox "No redundant paragraph marks in footnotes!", vbOKOnly,
"There have been no replacements!"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top