Table.Columns 屬性 (Publisher)
會傳回 Columns 集合,代表指定表格中的所有表格欄。
語法
運算式。列
表達 代表 Table 物件的變數。
範例
本範例在指定表格的每個儲存格中輸入粗體數字。 本範例假設指定的圖案是表格,而不是另一種類型的圖案。
Sub CountCellsByColumn()
Dim shpTable As Shape
Dim colTable As Column
Dim celTable As Cell
Dim intCount As Integer
intCount = 1
Set shpTable = ActiveDocument.Pages(2).Shapes(1)
'Loops through each column in the table
For Each colTable In shpTable.Table.Columns
'Loops through each cell in the column
For Each celTable In colTable.Cells
With celTable.Text
.Text = intCount
.ParagraphFormat.Alignment = _
pbParagraphAlignmentCenter
.Font.Bold = msoTrue
intCount = intCount + 1
End With
Next celTable
Next colTable
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應