UpdateAutoFormat 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