Hi, RobiNew! This is a workaround to delete spaces ending paragraphs only in footnotes but it is the fastest method:
Code:
Sub Footnotes_Spaces_Del()
'In the doc's footnotes, delete spaces ending paragraphs.
Dim oRng As range
Application.ScreenUpdating = False
Set oRng = ActiveDocument.StoryRanges(2)
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
'Find one space and an invisible paragraph sign:
.text = " ^p"
'Add an extra space (or more in case there are extra spaces elsewhere in footnotes)
'before a paragraph end (note that the para sign is absent here!):
.Replacement.text = " "
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
With oRng.Find
'Find more than one space (in case of error, replace ; with comma):
.text = Chr(32) & "{2;}"
'Delete them:
.Replacement.text = ""
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
Set oRng = Nothing
End Sub
PS. I tested my previous macro on a single footnote made of several paragraphs, but not
on several footnotes on the same page. This is the reason for my misunderstanding.
If you want to include the main text in the macro, add this just after ScreenUpdating = False line:
With ActiveDocument.range.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "^w^p"
.Replacement.text = "^p"
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With