PowerPoint) (Table.Columns 屬性

會傳回 Columns 集合,代表表格中的所有欄。 唯讀。

語法

運算式。欄

運算式 代表 Table 物件的變數。

傳回值

Columns

註解

如需傳回集合單一成員的詳細資訊,請參閱 從集合傳回物件。

範例

這則範例會顯示圖案編號、投影片編號以及使用中簡報第一個表格中的欄數。

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

另請參閱

Table 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。