TableAutoFormat

Syntax

TableAutoFormat [.Format = number] [, .Borders = number] [, .Shading = number] [, .Font = number] [, .Color = number] [, .AutoFit = number] [, .HeadingRows = number] [, .FirstColumn = number] [, .LastRow = number] [, .LastColumn = number]

Remarks

Applies a predefined look to a table. The arguments for the TableAutoFormat statement correspond to the options in the Table AutoFormat dialog box (Table menu).

Argument

Explanation

.Format

The format to apply: 0 (zero) corresponds to the first format listed in the Formats list box ("none"), 1 corresponds to the second format, and so on.

.Borders

If 1, applies the border properties of the specified format.

.Shading

If 1, applies the shading properties of the specified format.

.Font

If 1, applies the font properties of the specified format.

.Color

If 1, applies the color properties of the specified format.

.AutoFit

If 1, decreases the width of the table columns as much as possible without changing the way text wraps in the cells.

.HeadingRows

If 1, applies the heading-row properties of the specified format.

.FirstColumn

If 1, applies the first-column properties of the specified format.

.LastRow

If 1, applies the last-row properties of the specified format.

.LastColumn

If 1, applies the last-column properties of the specified format.


Example

This example applies all the properties of the Classic 2 table format to the table containing the insertion point. If the insertion point is not in a table, a message box is displayed.


If SelInfo(12) = -1 Then        'If insertion point is in a table
    TableAutoFormat .Format = 5, .Borders = 1, .Shading = 1, \
    .Font = 1, .Color = 1, .AutoFit = 1, .HeadingRows = 1, \
    .FirstColumn = 1, .LastRow = 0, .LastColumn = 1
Else
    MsgBox "The insertion point is not in a table."
End If

See Also

TableColumnWidth, TableHeadings, TableRowHeight, TableUpdateAutoFormat