Hi, RobinNew! The last macro is only for footnotes! If used on storyrange(1) that has empty paragraphs, it will merge the paragraphs. On the other hand, the macro that is always good for storyrange(1) won't be good for storyrange(2). I suggest you combine two codes in one: the first one for the main body/active document followed by the other one for footnotes. I could not make a code based on Find-Replace that would be good for both storyranges.
My combination:
Code:
Sub Del_Spaces_Starting_Paras()
'In the doc's main body and footnotes, delete spaces starting paras.
Dim myRng As range
Application.ScreenUpdating = False
'Work on active doc/main body:
Set myRng = ActiveDocument.StoryRanges(1)
selection.Find.ClearFormatting
selection.Find.Replacement.ClearFormatting
With myRng.Find
.text = "[^32^s^9]{1;}([!^13]@^13)"
'Or:
' .text = "[^32^s^9]{1;}(*^13)"
.Replacement.text = "\1"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Set myRng = ActiveDocument.StoryRanges(2)
With myRng.Find
.text = "[^32^s^9]{1;}([!^13]@^13)"
'Or:
' .text = "[^32^s^9]{1;}(*^13)"
.Replacement.text = "\1"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
.text = "[^13]{2;}"
.Replacement.text = ""
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
Set myRng = Nothing
End Sub
Or use the following code, which is not as fast as the Find_Replace code, but it is quite simple;
Sub Spaces_Starting_Paras_Del()
'In the doc's main body and footnotes, delete spaces starting paras.
Application.ScreenUpdating = False
For i = 1 To 2
For Each Para In ActiveDocument.StoryRanges(i).Paragraphs
Do While Para.range.Characters.First = Chr(32)
Para.range.Characters.First.Delete
Loop
Next Para
Next i
Application.ScreenUpdating = True
End Sub