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 のサポートおよびフィードバックを参照してください。