ColorIndex Property

Applies To

Border object, Font object.

Description

Returns or sets the color for the specified border or font object. Read/write Long.

Can be one of the following WdColorIndex constants:

  • wdAuto
  • wdBlack
  • wdBlue
  • wdBrightGreen
  • wdDarkBlue
  • wdDarkRed
  • wdDarkYellow
  • wdGray25
  • wdGray50
  • wdGreen
  • wdNoHighlight
  • wdPink
  • wdRed
  • wdTeal
  • wdTurquoise
  • wdViolet
  • wdWhite
  • wdYellow

Remarks

The wdByAuthor constant is not valid for border and font objects.

See Also

BackgroundPatternColorIndex property, DefaultBorderColorIndex property, DefaultHighlightColorIndex property, ForegroundPatternColorIndex property, HighlightColorIndex property, SelectCurrentColor method.

Example

This example changes the color of the text in the first paragraph in the active document.

ActiveDocument.Paragraphs(1).Range.Font.ColorIndex = wdGreen
This example formats the selected text to appear in red.

Selection.Font.ColorIndex = wdRed
This example adds a dotted red border around each cell in the first table.

If ActiveDocument.Tables.Count >= 1 Then
    For Each aBorder In ActiveDocument.Tables(1).Borders
        aBorder.ColorIndex = wdRed
        aBorder.LineStyle = wdLineStyleDashDot
        aBorder.LineWidth = wdLineWidth075pt
    Next aBorder
End If