Format related procedures in class Find (Word VBA)

This page presents procedures from class Find related to the theme Format: ClearFormatting, Font, Format, ParagraphFormat and Style

ClearFormatting

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

Sub ClrFmtgFind() 
 With Selection.Find 
 .ClearFormatting 
 .Font.Bold = True 
 .Execute FindText:="Hello", Format:=True, Forward:=True 
 If .Found = True Then 
 .Parent.Expand Unit:=wdParagraph 
 .Parent.Copy 
 End If 
 End With 
End Sub

Font

Returns or sets a Font object that represents the character formatting of the specified object.

To set this property, specify an expression that returns a Font object.

With Selection.Find 
 .ClearFormatting 
 .Font.Name = "Times New Roman" 
 .Execute FindText:="", ReplaceWith:="", Format:=True, _ 
 Forward:=True 
End With

Format

True if formatting is included in the find operation.

With ActiveDocument.Content.Find 
 .ClearFormatting 
 .Font.Bold = True 
 .Format = True 
 .Replacement.ClearFormatting 
 .Replacement.Font.Bold = False 
 .Execute Forward:=True, Replace:=wdReplaceAll, _ 
 FindText:="", ReplaceWith:="" 
End With

ParagraphFormat

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified find operation.

With ActiveDocument.Content.Find 
 .ClearFormatting 
 .ParagraphFormat.Space2 
 .Replacement.ClearFormatting 
 .Replacement.ParagraphFormat.Space15 
 .Execute FindText:="", ReplaceWith:="", _ 
 Replace:=wdReplaceAll 
End With

Style

Returns or sets the style for the specified style. Read/write Variant.

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

Selection.Find.Style =