Table.Columns property (PowerPoint)
Returns a Columns collection that represents all the columns in a table. Read-only.
Syntax
expression.Columns
expression A variable that represents a Table object.
Return value
Columns
Remarks
For information about returning a single member of a collection, see Returning an object from a collection.
Example
This example displays the shape number, the slide number, and the number of columns in the first table of the active presentation.
Dim ColCount As Integer
Dim sl As Integer
Dim 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
This example tests the selected shape to see if it contains a table. If it does, the code sets the width of column one to 72 points (one inch).
With ActiveWindow.Selection.ShapeRange
If .HasTable = True Then
.Table.Columns(1).Width = 72
End If
End With
See also
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.