傳回代表指定表格儲存格對角線框線的 CellBorder 物件。
語法
運算式。BorderDiagonal
運算式 代表 Cell 物件的變數。
傳回值
CellBorder
範例
本範例將指定表格中每隔一個儲存格斜切為兩半,並加上對角線框線。 此範例假設第二頁的第一個圖形是表格,而不是另一種類型的圖形。
Sub FillCellsByRow()
Dim shpTable As Shape
Dim rowTable As Row
Dim celTable As Cell
Dim intCell As Integer
intCell = 1
Set shpTable = ActiveDocument.Pages(2).Shapes(1)
For Each rowTable In shpTable.Table.Rows
For Each celTable In rowTable.Cells
If intCell Mod 2 = 0 Then
With celTable
.Diagonal = pbTableCellDiagonalDown
With .BorderDiagonal
.Weight = 1
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
End With
End With
celTable.Fill.ForeColor.RGB = RGB _
(Red:=180, Green:=180, Blue:=180)
Else
celTable.Fill.ForeColor.RGB = RGB _
(Red:=255, Green:=255, Blue:=255)
End If
intCell = intCell + 1
Next celTable
Next rowTable
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。