Format Property Example

The following example left aligns all the paragraphs in the active document.

ActiveDocument.Paragraphs.Format.Alignment = wdAlignParagraphLeft

This example applies Classic formatting to the tables of contents in Report.doc.

Documents("Report.doc").TablesOfContents.Format = wdTOCClassic

This example returns and displays the formatting of the text in the first field in the active document.

If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput Then
    MsgBox ActiveDocument.FormFields(1).TextInput.Format
Else
    MsgBox "First field is not a text form field"
End If

This example returns the formatting of the first paragraph in the active document and then applies the formatting to the selection.

Set paraFormat = ActiveDocument.Paragraphs(1).Format.Duplicate
Selection.Paragraphs.Format = paraFormat

This example removes all bold formatting in the active document.

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