列对象 (PowerPoint)

一个 的集合 对象,表示表中的列。

示例

使用 属性返回 的列 集合。 本示例查找当前演示文稿第一张表格、 集合中的对象的计数和向用户显示信息。

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

使用Add方法可向表格中添加一列。 本示例在现有表格中创建一个列,并将新列的宽度设置为 72 磅 (1 英寸)。

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

    .Columns.Add.Width = 72

End With

使用 (索引) 返回单个 对象。 索引表示列集合中 的位置, (通常从左到右进行计数;尽管 TableDirection属性可以反转此) 。 本示例选择第二张幻灯片上第五个形状中表格第一列。

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

另请参阅

PowerPoint 对象模型引用

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。