Share via


AddTable Method [Publisher 2003 VBA Language Reference]

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

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

expression Required. An expression that returns one of the objects in the Applies To list.

NumRows  Required Long. The number of rows in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.

NumColumns  Required Long. The number of columns in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.

Left  Required Variant. The position of the left edge of the shape representing the table.

Top  Required Variant. The position of the top edge of the shape representing the table.

Width  Required Variant. The width of the shape representing the table.

Height  Required Variant. The height of the shape representing the table.

FixedSize  Optional Boolean. True if Microsoft Publisher reduces the number of rows and columns of the table to fit the specified width and height. False if Microsoft 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.

PbTableDirectionType

PbTableDirectionType can be one of these PbTableDirectionType constants.
pbTableDirectionLeftToRight Table columns are numbered from left to right. Default for left-to-right languages.
pbTableDirectionRightToLeft Table columns are numbered from right to left. Default for right-to-left languages.

Remarks

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

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)

Applies to | Shapes Collection