How to: Work with Tables
Last modified: February 07, 2012
Applies to: Office 2013 | PowerPoint 2013 | PowerPoint Automation Services | VBA
In Microsoft Office PowerPoint, you can create native tables without having to import them from Microsoft Office Word. Tables are members of the Shapes collection. Each cell, column, and row in a table is a separate programmable object.
To create a table on a slide, use the AddTable method. This method adds a table to the Shapes collection with the number of rows and columns designated by the NumRows and NumColumns arguments. This example adds a table with three rows and four columns to slide two.
Before you can work with the contents or objects in a table, you must first know if the shape you are working with is a table. To see whether a shape is a table, use the HasTable property. For example, assume that slide one has numerous shapes and you know one of them is a table. You want to resize this table so that it is the proper size to accept the data you are going to import from another source. This code walks through the Shapes collection on slide two to find the table and then it resizes the width of the columns.
To return the contents and properties of an individual column or row, use a specific member of either the Columns or the Rows collection. The Cell method returns a single Cell object within a Table. This example changes various attributes of the table represented by shape five on slide two. It changes the color of row two, the width of column one, and the text contained in the row two, column one cell.