As I said, the code was sufficient for a document with
one Section. To work with multiple Sections, you'd need code like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range, Sctn As Section, HdFt As HeaderFooter
With ActiveDocument
For Each Rng In .StoryRanges
Call FndRepRng(Rng)
Next
For Each Sctn In .Sections
For Each HdFt In Sctn.Headers
With HdFt
If .LinkToPrevious = False Then
Call FndRepRng(HdFt.Range)
End If
End With
Next
For Each HdFt In Sctn.Footers
With HdFt
If .LinkToPrevious = False Then
Call FndRepRng(HdFt.Range)
End If
End With
Next
Next
End With
End Sub
Sub FndRepRng(Rng As Range)
With Rng.Find
.ClearFormatting
.Text = ""
.Font.ColorIndex = wdBlue
With .Replacement
.ClearFormatting
.Text = ""
.Font.ColorIndex = wdBlack
End With
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Execute Replace:=wdReplaceAll
End With
End Sub