UpdateAutoFormat Method

Applies To

Table object.

Description

Updates the table with the characteristics of a predefined table format. For example, if you apply a table format with AutoFormat and then insert rows and columns, the table may no longer match the predefined look. UpdateAutoFormat restores the format.

Syntax

expression.UpdateAutoFormat

expression Required. An expression that returns a Table object.

See Also

AutoFormat method, AutoFormatType property, SetHeight method, SetWidth method.

Example

This example creates a table, applies a predefined format to it, adds a row, and then reapplies the predefined format.

Set newDoc = Documents.Add 
Set myTable = newDoc.Tables.Add(Selection.Range, 5, 5)
With myTable
    .AutoFormat Format:=wdTableFormatColumns1
    .Rows.Add BeforeRow:=myTable.Rows(1)
End With
MsgBox "Click OK to reapply autoformatting."
myTable.UpdateAutoFormat
This example restores the predefined format to the table that contains the insertion point.

If Selection.Information(wdWithInTable) = True Then
    Selection.Tables(1).UpdateAutoFormat
Else
    MsgBox "The insertion point is not in a table."
End If