Export (0) Print
Expand All

Find.Replacement Property (Word)

Returns a Replacement object that contains the criteria for a replace operation.

expression .Replacement

expression An expression that returns a Find object.

This example removes bold formatting from the active document. The Bold property of the Font object 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 but 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

Concepts

Other resources

Show:
© 2015 Microsoft