Class Shading (Word VBA)

Contains shading attributes for an object.

Set

To use a Shading class variable it first needs to be instantiated, for example

Dim shd as Shading
Set shd = Selection.Shading

The following procedures can be used to set variables of type Shading: Cell.Shading, Cells.Shading, Column.Shading, Columns.Shading, ConditionalStyle.Shading, Font.Shading, Frame.Shading, Paragraph.Shading, ParagraphFormat.Shading, Paragraphs.Shading, Range.Shading, Row.Shading, Rows.Shading, Selection.Shading, Style.Shading, Table.Shading and TableStyle.Shading

BackgroundPatternColor

Returns or sets the 24-bit color that's applied to the background of the Shading object.

Possible Values are wdColorAqua - Aqua color, wdColorAutomatic - Automatic color; default; usually black, wdColorBlack - Black color, wdColorBlue - Blue color, wdColorBlueGray - Blue-gray color, wdColorBrightGreen - Bright green color, wdColorBrown - Brown color, wdColorDarkBlue - Dark blue color, wdColorDarkGreen - Dark green color, wdColorDarkRed - Dark red color, wdColorDarkTeal - Dark teal color, wdColorDarkYellow - Dark yellow color, wdColorGold - Gold color, wdColorGray05 - Shade 05 of gray color, wdColorGray10 - Shade 10 of gray color, wdColorGray125 - Shade 125 of gray color, wdColorGray15 - Shade 15 of gray color, wdColorGray20 - Shade 20 of gray color, wdColorGray25 - Shade 25 of gray color, wdColorGray30 - Shade 30 of gray color, wdColorGray35 - Shade 35 of gray color, wdColorGray375 - Shade 375 of gray color, wdColorGray40 - Shade 40 of gray color, wdColorGray45 - Shade 45 of gray color, wdColorGray50 - Shade 50 of gray color, wdColorGray55 - Shade 55 of gray color, wdColorGray60 - Shade 60 of gray color, wdColorGray625 - Shade 625 of gray color, wdColorGray65 - Shade 65 of gray color, wdColorGray70 - Shade 70 of gray color, wdColorGray75 - Shade 75 of gray color, wdColorGray80 - Shade 80 of gray color, wdColorGray85 - Shade 85 of gray color, wdColorGray875 - Shade 875 of gray color, wdColorGray90 - Shade 90 of gray color, wdColorGray95 - Shade 95 of gray color, wdColorGreen - Green color, wdColorIndigo - Indigo color, wdColorLavender - Lavender color, wdColorLightBlue - Light blue color, wdColorLightGreen - Light green color, wdColorLightOrange - Light orange color, wdColorLightTurquoise - Light turquoise color, wdColorLightYellow - Light yellow color, wdColorLime - Lime color, wdColorOliveGreen - Olive green color, wdColorOrange - Orange color, wdColorPaleBlue - Pale blue color, wdColorPink - Pink color, wdColorPlum - Plum color, wdColorRed - Red color, wdColorRose - Rose color, wdColorSeaGreen - Sea green color, wdColorSkyBlue - Sky blue color, wdColorTan - Tan color, wdColorTeal - Teal color, wdColorTurquoise - Turquoise color, wdColorViolet - Violet color, wdColorWhite - White color, wdColorYellow - Yellow color.

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

Set myRange = ActiveDocument.Paragraphs(1).Range 
myRange.Shading.BackgroundPatternColor = _ 
 wdColorTurquoise

BackgroundPatternColorIndex

Returns or sets the color that's applied to the background of the Shading object.

Possible Values are wdAuto - Automatic color. Default; usually black, wdBlack - Black color, wdBlue - Blue color, wdBrightGreen - Bright green color, wdByAuthor - Color defined by document author, wdClassicBlue, wdClassicRed, wdDarkBlue - Dark blue color, wdDarkRed - Dark red color, wdDarkYellow - Dark yellow color, wdGray25 - Shade 25 of gray color, wdGray50 - Shade 50 of gray color, wdGreen - Green color, wdNoHighlight - Removes highlighting that has been applied, wdPink - Pink color, wdRed - Red color, wdTeal - Teal color, wdTurquoise - Turquoise color, wdViolet - Violet color, wdWhite - White color, wdYellow - Yellow color.
Dim rngTemp As Range 
 
Set rngTemp = ActiveDocument.Paragraphs(1).Range 
rngTemp.Shading.BackgroundPatternColorIndex = wdTurquoise

ForegroundPatternColor

Returns or sets the 24-bit color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern.

Possible Values are wdColorAqua - Aqua color, wdColorAutomatic - Automatic color; default; usually black, wdColorBlack - Black color, wdColorBlue - Blue color, wdColorBlueGray - Blue-gray color, wdColorBrightGreen - Bright green color, wdColorBrown - Brown color, wdColorDarkBlue - Dark blue color, wdColorDarkGreen - Dark green color, wdColorDarkRed - Dark red color, wdColorDarkTeal - Dark teal color, wdColorDarkYellow - Dark yellow color, wdColorGold - Gold color, wdColorGray05 - Shade 05 of gray color, wdColorGray10 - Shade 10 of gray color, wdColorGray125 - Shade 125 of gray color, wdColorGray15 - Shade 15 of gray color, wdColorGray20 - Shade 20 of gray color, wdColorGray25 - Shade 25 of gray color, wdColorGray30 - Shade 30 of gray color, wdColorGray35 - Shade 35 of gray color, wdColorGray375 - Shade 375 of gray color, wdColorGray40 - Shade 40 of gray color, wdColorGray45 - Shade 45 of gray color, wdColorGray50 - Shade 50 of gray color, wdColorGray55 - Shade 55 of gray color, wdColorGray60 - Shade 60 of gray color, wdColorGray625 - Shade 625 of gray color, wdColorGray65 - Shade 65 of gray color, wdColorGray70 - Shade 70 of gray color, wdColorGray75 - Shade 75 of gray color, wdColorGray80 - Shade 80 of gray color, wdColorGray85 - Shade 85 of gray color, wdColorGray875 - Shade 875 of gray color, wdColorGray90 - Shade 90 of gray color, wdColorGray95 - Shade 95 of gray color, wdColorGreen - Green color, wdColorIndigo - Indigo color, wdColorLavender - Lavender color, wdColorLightBlue - Light blue color, wdColorLightGreen - Light green color, wdColorLightOrange - Light orange color, wdColorLightTurquoise - Light turquoise color, wdColorLightYellow - Light yellow color, wdColorLime - Lime color, wdColorOliveGreen - Olive green color, wdColorOrange - Orange color, wdColorPaleBlue - Pale blue color, wdColorPink - Pink color, wdColorPlum - Plum color, wdColorRed - Red color, wdColorRose - Rose color, wdColorSeaGreen - Sea green color, wdColorSkyBlue - Sky blue color, wdColorTan - Tan color, wdColorTeal - Teal color, wdColorTurquoise - Turquoise color, wdColorViolet - Violet color, wdColorWhite - White color, wdColorYellow - Yellow color.

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

With Selection.Shading 
 .Texture = wdTexture30Percent 
 .ForegroundPatternColor = wdColorTeal 
 .BackgroundPatternColor = wdColorDarkRed 
End With

ForegroundPatternColorIndex

Returns or sets the color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern.

Possible Values are wdAuto - Automatic color. Default; usually black, wdBlack - Black color, wdBlue - Blue color, wdBrightGreen - Bright green color, wdByAuthor - Color defined by document author, wdClassicBlue, wdClassicRed, wdDarkBlue - Dark blue color, wdDarkRed - Dark red color, wdDarkYellow - Dark yellow color, wdGray25 - Shade 25 of gray color, wdGray50 - Shade 50 of gray color, wdGreen - Green color, wdNoHighlight - Removes highlighting that has been applied, wdPink - Pink color, wdRed - Red color, wdTeal - Teal color, wdTurquoise - Turquoise color, wdViolet - Violet color, wdWhite - White color, wdYellow - Yellow color.
With Selection.Shading 
 .Texture = wdTexture30Percent 
 .ForegroundPatternColorIndex = wdBlue 
 .BackgroundPatternColorIndex = wdYellow 
End With

Parent

Returns an object that represents the parent object of the specified Shading object.

Dim objParent As Object
Set objParent = Selection.Shading.Parent

Texture

Returns or sets the shading texture for the specified object.

Possible Values are wdTexture10Percent - 10 percent shading, wdTexture12Pt5Percent - 12.5 percent shading, wdTexture15Percent - 15 percent shading, wdTexture17Pt5Percent - 17.5 percent shading, wdTexture20Percent - 20 percent shading, wdTexture22Pt5Percent - 22.5 percent shading, wdTexture25Percent - 25 percent shading, wdTexture27Pt5Percent - 27.5 percent shading, wdTexture2Pt5Percent - 2.5 percent shading, wdTexture30Percent - 30 percent shading, wdTexture32Pt5Percent - 32.5 percent shading, wdTexture35Percent - 35 percent shading, wdTexture37Pt5Percent - 37.5 percent shading, wdTexture40Percent - 40 percent shading, wdTexture42Pt5Percent - 42.5 percent shading, wdTexture45Percent - 45 percent shading, wdTexture47Pt5Percent - 47.5 percent shading, wdTexture50Percent - 50 percent shading, wdTexture52Pt5Percent - 52.5 percent shading, wdTexture55Percent - 55 percent shading, wdTexture57Pt5Percent - 57.5 percent shading, wdTexture5Percent - 5 percent shading, wdTexture60Percent - 60 percent shading, wdTexture62Pt5Percent - 62.5 percent shading, wdTexture65Percent - 65 percent shading, wdTexture67Pt5Percent - 67.5 percent shading, wdTexture70Percent - 70 percent shading, wdTexture72Pt5Percent - 72.5 percent shading, wdTexture75Percent - 75 percent shading, wdTexture77Pt5Percent - 77.5 percent shading, wdTexture7Pt5Percent - 7.5 percent shading, wdTexture80Percent - 80 percent shading, wdTexture82Pt5Percent - 82.5 percent shading, wdTexture85Percent - 85 percent shading, wdTexture87Pt5Percent - 87.5 percent shading, wdTexture90Percent - 90 percent shading, wdTexture92Pt5Percent - 92.5 percent shading, wdTexture95Percent - 95 percent shading, wdTexture97Pt5Percent - 97.5 percent shading, wdTextureCross - Horizontal cross shading, wdTextureDarkCross - Dark horizontal cross shading, wdTextureDarkDiagonalCross - Dark diagonal cross shading, wdTextureDarkDiagonalDown - Dark diagonal down shading, wdTextureDarkDiagonalUp - Dark diagonal up shading, wdTextureDarkHorizontal - Dark horizontal shading, wdTextureDarkVertical - Dark vertical shading, wdTextureDiagonalCross - Diagonal cross shading, wdTextureDiagonalDown - Diagonal down shading, wdTextureDiagonalUp - Diagonal up shading, wdTextureHorizontal - Horizontal shading, wdTextureNone - No shading, wdTextureSolid - Solid shading, wdTextureVertical - Vertical shading.
Set myRange = ActiveDocument.Paragraphs(1).Range 
myRange.Shading.Texture = wdTextureCross