Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.