返回表示指定表格单元格的左边框的 CellBorder 对象。
语法
表达式。BorderLeft
表达式 表示 Cell 对象的变量。
返回值
CellBorder
示例
此示例通过使用边框和填充颜色与现有表格创建棋盘设计。 此示例假定第 2 页上的第一个形状是表格而非其他类型的形状,并且表格具有不偶数列。
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
With celTable
With .BorderBottom
.Weight = 2
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
End With
With .BorderTop
.Weight = 2
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
End With
With .BorderLeft
.Weight = 2
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
End With
With .BorderRight
.Weight = 2
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
End With
End With
If intCell Mod 2 = 0 Then
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 支持和反馈,获取有关如何接收支持和提供反馈的指南。