Format Property

Applies To

Find object, Indexes collection object, Paragraph object, Paragraphs collection object, TablesOfAuthorities collection object, TablesOfContents collection object, TablesOfFigures collection object, TextInput object.

Description

Returns or sets the formatting for the specified object, as described in the following table.

Object

Description

Indexes

Returns or sets the formatting for the indexes in the specified document. Can be one of the following WdIndexFormat constants: wdIndexBulleted, wdIndexClassic, wdIndexFancy, wdIndexFormal, wdIndexModern, wdIndexSimple, or wdIndexTemplate. Read/write Long.

Find

True if formatting is included in the find operation. Read/write Boolean.

Paragraph, Paragraphs

Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs. Read/write.

TablesOfAuthorities

Returns or sets the formatting for the tables of authorities in the specified document. Can be one of the following WdTOAFormat constants: wdTOAClassic, wdTOADistinctive, wdTOAFormal, wdTOASimple, or wdTOATemplate. Read/write Long.

TablesOfContents

Returns or sets the formatting for the tables of contents in the specified document. Can be one of the following WdTOCFormat constants: wdTOCClassic, wdTOCDistinctive, wdTOCFancy, wdTOCFormal, wdTOCModern, wdTOCSimple, or wdTOCTemplate. Read/write Long.


(continued)

TablesOfFigures

Returns or sets the formatting for the tables of figures in the specified document. Can be one of the following WdTOFFormat constants: wdTOFCentered, wdTOFClassic, wdTOFDistinctive, wdTOFFormal, wdTOFSimple, or wdTOFTemplate. Read/write Long.

TextInput

Returns the text formatting for the specified text box. Read-only String.

Use the EditType method of the TextInput object to set the text formatting.


See Also

AutoFormat method, EditingType property, Execute method (Find object), ParagraphFormat object.

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