Add Method (Tables Collection)

See Also         Example         Applies To

Adds a new, blank table to a document.

Syntax

expression.Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)

expression   Required. An expression that returns a Tables object.

Range   Required Range. The range where you want the table to appear. The table replaces the range, if the range isn't collapsed.

NumRows   Required Long. The number of rows you want to include in the table.

NumColumns   Required Long. The number of columns you want to include in the table.

DefaultTableBehavior   Optional Variant. Sets a value that specifies whether Microsoft Word automatically resizes cells in tables to fit the cells’ contents (AutoFit). Can be either of the following constants: wdWord8TableBehavior (AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default constant is wdWord8TableBehavior.

AutoFitBehavior   Optional Variant. Sets the AutoFit rules for how Word sizes tables. Can be one of the following WdAutoFitBehavior constants: wdAutoFitContent, wdAutoFitFixed, or wdAutoFitWindow. If DefaultTableBehavior is set to wdWord8TableBehavior, this argument is ignored.