Format Property

Microsoft Word Visual Basic

Show All

Format Property

       

Format property as it applies to the Find object.

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

expression.Format

expression   Required. An expression that returns a Find object.

Format property as it applies to the Indexes object.

Returns or sets the formatting for the indexes in the specified document. Read/write WdIndexFormat.

WdIndexFormat can be one of these WdIndexFormat constants.
wdIndexBulleted
wdIndexFancy
wdIndexModern
wdIndexTemplate
wdIndexClassic
wdIndexFormal
wdIndexSimple

expression.Format

expression   Required. An expression that returns an Indexes object.

Format property as it applies to the Paragraph and Paragraphs objects.

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

expression.Format

expression   Required. An expression that returns one of the above objects.

Format property as it applies to the TablesOfAuthorities object.

Returns or sets the formatting for the tables of authorities in the specified document. Read/write WdToaFormat.

WdToaFormat can be one of these WdToaFormat constants.
wdTOAClassic
wdTOAFormal
wdTOATemplate
wdTOADistinctive
wdTOASimple

expression.Format

expression   Required. An expression that returns a TablesOfAuthorities object.

Format property as it applies to the TablesOfContents object.

Returns or sets the formatting for the tables of contents in the specified document. Read/write WdTocFormat.

WdTocFormat can be one of these WdTocFormat constants.
wdTOCDistinctive
wdTOCFormal
wdTOCSimple
wdTOCClassic
wdTOCFancy
wdTOCModern
wdTOCTemplate

expression.Format

expression   Required. An expression that returns a TablesOfContents object.

Format property as it applies to the TablesOfFigures object.

Returns or sets the formatting for the tables of figures in the specified document. Read/write WdTofFormat.

WdTofFormat can be one of these WdTofFormat constants.
wdTOFCentered
wdTOFDistinctive
wdTOFSimple
wdTOFClassic
wdTOFFormal
wdTOFTemplate

expression.Format

expression   Required. An expression that returns a TablesOfFigures object.

Format property as it applies to the TextInput object.

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

expression.Format

expression   Required. An expression that returns a TextInput object.

Example

As it applies to the Find object.

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

As it applies to the Paragraph object.

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

As it applies to the Paragraphs object.

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

ActiveDocument.Paragraphs.Format.Alignment = wdAlignParagraphLeft

As it applies to the TablesOfContents object.

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

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

As it applies to the TextInput object.

This example displays the text formatting in the first field of 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