Replacement Property
Applies To
Find object.
Description
Returns a Replacement object that contains the criteria for a replace operation. Read-only.
See Also
Execute method (Find object), Find property.
Example
This example removes bold formatting from the active document. The Bold property is True for the Find object and False for the Replacement object.
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Bold = True
With .Replacement
.ClearFormatting
.Font.Bold = False
End With
.Execute FindText:="", ReplaceWith:="", Format:=True, _
Replace:=wdReplaceAll
End With
This example finds every instance of the word "Start" in the active document and replaces it with "End". The find operation ignores formatting and matches the case of the text to find ("Start").
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
With myRange.Find
.ClearFormatting
.Text = "Start"
With .Replacement
.ClearFormatting
.Text = "End"
End With
.Execute Replace:=wdReplaceAll, Format:=True, MatchCase:=True, _
MatchWholeWord:=True
End With