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

Columns Object (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

A collection of Column objects that represent the columns in a table.

Example

Use the Columns property to return the Columns collection. This example finds the first table in the active presentation, counts the number of Column objects in the Columns collection, and displays information to the user.

Dim ColCount, sl, sh As Integer

With ActivePresentation
    For sl = 1 To .Slides.Count
        For sh = 1 To .Slides(sl).Shapes.Count
            If .Slides(sl).Shapes(sh).HasTable Then
                ColCount = .Slides(sl).Shapes(sh) _
                    .Table.Columns.Count
                MsgBox "Shape " &; sh &; " on slide " &; sl &; _
                    " contains the first table and has " &; _
                    ColCount &; " columns."
                Exit Sub
            End If
        Next
    Next
End With

Use the Addmethod to add a column to a table. This example creates a column in an existing table and sets the width of the new column to 72 points (one inch).

With ActivePresentation.Slides(2).Shapes(5).Table

    .Columns.Add.Width = 72

End With

Use Columns (index) to return a single Column object. Index represents the position of the column in the Columns collection (usually counting from left to right; although theTableDirectionproperty can reverse this). This example selects the first column of the table in shape five on the second slide.

ActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Select

See also

Concepts

PowerPoint Object Model Reference

© 2017 Microsoft