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 
 .Font.Bold = True 
 With .Replacement 
 .Font.Bold = False 
 End With 
 .Execute FindText:="", ReplaceWith:="", Format:=True, _ 
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 
 .Text = "Start" 
 With .Replacement 
 .Text = "End" 
 End With 
 .Execute Replace:=wdReplaceAll, _ 
 Format:=True, MatchCase:=True, _ 
End With


Other resources

© 2015 Microsoft