Replacement.ClearFormatting Method (Word)

Removes text and paragraph formatting from the text specified in a replace operation.

Syntax

expression .ClearFormatting

expression A variable that represents a Replacement object.

Example

This example clears formatting from the find or replace criteria before replacing the word "Inc." with "incorporated" throughout the active document.

Sub ClrFmtgReplace() 
 Dim rngTemp As Range 
 Set rngTemp = ActiveDocument.Content 
 With rngTemp.Find 
 .ClearFormatting 
 .Replacement.ClearFormatting 
 .MatchWholeWord = True 
 .Execute FindText:="Inc.", ReplaceWith:="incorporated", _ 
 Replace:=wdReplaceAll 
 End With 
End Sub

See Also

Concepts

Replacement Object

Replacement Object Members