Class Shading (Word VBA)
Contains shading attributes for an object. To use a Shading class variable it first needs to be instantiated, for example
Dim shd as Shading
Set shd = Selection.Shading
BackgroundPatternColor
Returns or sets the 24-bit color that's applied to the background of the Shading object. Here you can find possible values for
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. Here you can find possible values for
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. Here you can find possible values for
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. Here you can find possible values for
With Selection.Shading
.Texture = wdTexture30Percent
.ForegroundPatternColorIndex = wdBlue
.BackgroundPatternColorIndex = wdYellow
End With
Texture
Returns or sets the shading texture for the specified object. Here you can find possible values for
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.Shading.Texture = wdTextureCross