Class Table (Word VBA)

The class Table represents a single table. The Table object is a member of the Tables collection. The Tables collection includes all the tables in the specified selection, range, or document.

The classes Range and Selection. give access to class Table


Dim tbl as Table
Set tbl = ActiveDocument.Tables(Index:=1)

For Each

Here is an example of processing the Table items in a collection.


Dim tbl As Table
For Each tbl In ActiveDocument.Tables
	
Next tbl

Methods

ApplyStyleDirectFormatting - Applies the specified style but maintains any formatting that a user directly applies.

AutoFitBehavior - Determines how Microsoft Word resizes a table when the AutoFit feature is used.

AutoFormat - Applies a predefined look to a table.

Cell - Returns a Cell object that represents a cell in a table.

ConvertToText - Converts a table to text and returns a Range object that represents the delimited text.

Delete - Deletes the specified table.

Select - Selects the specified table.

Sort - Sorts the specified table.

SortAscending - Sorts paragraphs or table rows in ascending alphanumeric order.

SortDescending - Sorts table rows in descending alphanumeric order.

Split - Inserts an empty paragraph immediately above the specified row in the table, and returns a Table object that contains both the specified row and the rows that follow it.

UpdateAutoFormat - Updates the table with the characteristics of a predefined table format.

Properties

Range (Default member) - Returns a Range object that represents the portion of a document that is contained within the specified table.

AllowAutoFit allows Microsoft Word to automatically resize cells in a table to fit their contents.

ApplyStyleColumnBands returns or sets a Boolean that represents whether to apply style bands to the columns in a table if an applied preset table style provides style banding for columns.

ApplyStyleFirstColumn true for Microsoft Word to apply first-column formatting to the first column of the specified table.

ApplyStyleHeadingRows true for Microsoft Word to apply heading-row formatting to the first row of the selected table.

ApplyStyleLastColumn true for Microsoft Word to apply last-column formatting to the last column of the specified table.

ApplyStyleLastRow true for Microsoft Word to apply last-row formatting to the last row of the specified table.

ApplyStyleRowBands returns or sets a Boolean that represents whether to apply style bands to the rows in a table if an applied preset table style provides style banding for rows.

AutoFormatType returns the type of automatic formatting that's been applied to the specified table.

Borders returns a Borders collection that represents all the borders for the specified object.

BottomPadding returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table.

Columns returns a Columns collection that represents all the table columns in the table.

Descr returns or sets a String that contains a description for the specified table.

ID returns or sets the identifying label for the specified table when the document is saved as a webpage.

LeftPadding returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table.

NestingLevel returns the nesting level of the specified table.

PreferredWidth returns or sets the preferred width (in points or as a percentage of the window width) for the specified table.

PreferredWidthType returns or sets the preferred unit of measurement to use for the width of the specified table.

RightPadding returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table.

Rows returns a Rows collection that represents all the table rows within a table.

Shading returns a Shading object that refers to the shading formatting for the specified object.

Spacing returns or sets the spacing (in points) between the cells in a table.

Style returns or sets the style for the specified table. Read/write Variant.

TableDirection returns or sets the direction in which Microsoft Word orders cells in the specified table.

Tables returns a Tables collection that represents all the tables nested within the specified table.

Title returns or sets a String that contains a title for the specified table.

TopPadding returns or sets the amount of space (in points) to add above the contents of all the cells in a table.

Uniform true if all the rows in a table have the same number of columns.

Borders - A collection of Border objects that represent the borders of an object.

Cell - Represents a single table cell. The Cell object is a member of the Cells collection. The Cells collection represents all the cells in the specified object.

Columns - A collection of Column objects that represent the columns in a table.

Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.

Rows - A collection of Row objects that represent the table rows in the specified selection, range, or table.

Shading - Contains shading attributes for an object.

Style - Represents a single built-in or user-defined style. The Style object includes style attributes (such as font, font style, and paragraph spacing) as properties of the Style object. The Style object is a member of the Styles collection. The Styles collection includes all the styles in the specified document.

Tables - A collection of Table objects that represent the tables in a selection, range, or document.