Shapes.AddTable method (Publisher)
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
Name | Required/Optional | Data type | Description |
---|---|---|---|
NumRows | Required | Long | The number of rows in the new table. Values between 1 and 128 are valid; any values outside this range 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 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 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. |
Direction | Optional | PbTableDirectionType | The 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.
Constant | Description |
---|---|
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. |
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)
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.