Compartilhar via


Shading.BackgroundPatternColorIndex Property (Word)

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.

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

See Also

Concepts

Shading Object

Shading Object Members