Shading.BackgroundPatternColorIndex Property

Word Developer Reference

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

Syntax

expression.BackgroundPatternColorIndex

expression   Required. A variable that represents a Shading object.

Example

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

Visual Basic for Applications
  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.

Visual Basic for Applications
  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

See Also