Table of contents
TOC
Collapse the table of content
Expand the table of content

Shapes.AddTable Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Adds a new Shape object representing a table to the specified Shapes collection.

Syntax

expression. AddTable( NumRows, NumColumns, Left, Top, Width, Height, FixedSize, Direction)

_expression_A variable that represents a Shapes object.

Parameters

NameRequired/OptionalData TypeDescription
NumRowsRequiredLongThe number of rows in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.
NumColumnsRequiredLongThe number of columns in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.
LeftRequiredVariantThe position of the left edge of the shape representing the table.
TopRequiredVariantThe position of the top edge of the shape representing the table.
WidthRequiredVariantThe width of the shape representing the table.
HeightRequiredVariantThe height of the shape representing the table.
FixedSizeOptionalBooleanTrue if Microsoft Publisher reduces the number of rows and columns of the table to fit the specified width and height. False if Publisher automatically increases the width and height of the table frame to accommodate the number of rows and columns in the table. Default is False.
DirectionOptionalPbTableDirectionTypeThe direction in which table columns are numbered. The default depends on the current language setting.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

The Direction parameter can be one of the PbTableDirectionType constants declared in the Microsoft Publisher type library and shown in the following table.

ConstantDescription
pbTableDirectionLeftToRightTable columns are numbered from left to right. Default for left-to-right languages.
pbTableDirectionRightToLeftTable columns are numbered from right to left. Default for right-to-left languages.

Example

This example creates a new table on the first page of the active publication.

Dim shpTable As Shape 

Set shpTable = ActiveDocument.Pages(1).Shapes.AddTable _ 
 (NumRows:=3, NumColumns:=4, _ 
 Left:=10, Top:=10, _ 
 Width:=288, Height:=216) 
© 2018 Microsoft