BackgroundPatternColorIndex Property

Microsoft Word Visual Basic

Returns or sets the color that's applied to the background of the Shading object. Read/write WdColorIndex.

WdColorIndex can be one of these WdColorIndex constants.
wdAuto
wdBlack
wdBlue
wdBrightGreen
wdByAuthor
wdDarkBlue
wdDarkRed
wdDarkYellow
wdGray25
wdGray50
wdGreen
wdNoHighlight
wdPink
wdRed
wdTeal
wdTurquoise
wdViolet
wdWhite
wdYellow

expression.BackgroundPatternColorIndex

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example applies cyan background shading to the first paragraph in the active document.

Dim rngTemp As Range

Set rngTemp = ActiveDocument.Paragraphs(1).Range
rngTemp.Shading.BackgroundPatternColorIndex = wdTurquoise
		

This example adds a table at the insertion point and then applies light gray background shading to the first cell.

Dim tableNew As Table

Selection.Collapse Direction:=wdCollapseStart
Set tableNew = ActiveDocument.Tables.Add(Range:=Selection.Range, _
    NumRows:=2, NumColumns:=2)
tableNew.Cell(1, 1).Shading.BackgroundPatternColorIndex = _
    wdGray25