AddTable Method

Microsoft PowerPoint Visual Basic

AddTable Method

       

Adds a table shape to a slide.

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

expression   Required. An expression that returns a Shape object.

NumRows   Required Long. The number of rows in the table.

NumColumns   Required Long. The number of columns in the table.

Left   Optional Single. The distance (in points) from the left edge of the slide to the left edge of the table.

Top   Optional Single. The distance (in points) from the top edge of the slide to the top edge of the table.

Width   Optional Single. The width (in points) of the new table.

Height   Optional Single. The height (in points) of the new table.

Example

This example creates a new table on slide two of the active presentation. The table has three rows and four columns. It is 10 points from the left edge of the slide, and 10 points from the top edge. The width of the new table is 288 points, which makes each of the four columns one inch wide (there are 72 points per inch). The height is set to 216 points, which makes each of the three rows one inch tall.

ActivePresentation.Slides(2).Shapes _
    .AddTable(3, 4, 10, 10, 288, 216)