Table.Columns 属性 (PowerPoint)
返回代表表格中所有列的 Columns 集合。 只读。
语法
表达式。列
表达 一个代表 Table 对象的变量。
返回值
列数
备注
有关返回集合的单个成员的信息,请参阅 从集合中返回对象。
示例
本示例显示活动演示文稿内第一个表格中的形状数、幻灯片数以及列数。
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
本示例检测选定的形状以查看其是否包含表格。 如果包含表格,则此代码将设置第一列的列宽为 72 磅(一英寸)。
With ActiveWindow.Selection.ShapeRange
If .HasTable = True Then
.Table.Columns(1).Width = 72
End If
End With
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。