返回或设置指定边框或字体的颜色。WdColorIndex,可读写。
| WdColorIndex 可以是下列 WdColorIndex 常量之一: |
| wdAuto |
| wdBlack |
| wdBlue |
| wdBrightGreen |
| wdByAuthor |
| wdDarkBlue |
| wdDarkRed |
| wdDarkYellow |
| wdGray25 |
| wdGray50 |
| wdGreen |
| wdNoHighlight |
| wdPink |
| wdRed |
| wdTeal |
| wdTurquoise |
| wdViolet |
| wdWhite |
| wdYellow |
expression.ColorIndex
expression 必需。该表达式返回“应用于”列表中的一个对象。
wdByAuthor 常量对边框和字体对象无效。
本示例更改活动文档首段的文字颜色。
ActiveDocument.Paragraphs(1).Range.Font.ColorIndex = wdGreen
本示例将所选文本的格式设置为红色。
Selection.Font.ColorIndex = wdRed
本示例为第一个表格的每个单元格添加红虚线边框。
Dim borderLoop As Border
If ActiveDocument.Tables.Count >= 1 Then
For Each borderLoop In ActiveDocument.Tables(1).Borders
With borderLoop
.ColorIndex = wdRed
.LineStyle = wdLineStyleDashDot
.LineWidth = wdLineWidth075pt
End With
Next borderLoop
End If