Class FillFormat (Word VBA)

The class FillFormat represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semi-transparent fill.


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

Dim fft as FillFormat
Set fft = Selection.Font.Fill

The following procedures can be used to set variables of type FillFormat: ChartFormat.Fill, Font.Fill, InlineShape.Fill, Shape.Fill and ShapeRange.Fill


Other Methods

PresetGradient - Sets the specified fill to a preset gradient.

Dim lngVariant As Long: lngVariant =  
Selection.Font.Fill.PresetGradient Style:=msoGradientMixed, Variant:=lngVariant, PresetGradientType:=msoPresetGradientMixed


BackColor returns or sets a ColorFormat object that represents the background color for the fill Read/write.

Dim cftBackColor As ColorFormat
Set cftBackColor = Selection.Font.Fill.BackColor

ForeColor returns or sets a ColorFormat object that represents the foreground color for the fill.

Dim cftForeColor As ColorFormat
Set cftForeColor = Selection.Font.Fill.ForeColor

GradientAngle returns or sets the angle of the gradient fill for the specified fill format.

Selection.Font.Fill.GradientAngle =

GradientColorType returns the gradient color type for the specified fill.

Dim mgcGradientColorType As Office.MsoGradientColorType
mgcGradientColorType = Selection.Font.Fill.GradientColorType

GradientDegree returns a value that indicates how dark or light a one-color gradient fill is.

Dim sngGradientDegree As Single
sngGradientDegree = Selection.Font.Fill.GradientDegree

GradientStops returns the GradientStops collection associated with the specified fill format.

Dim gssGradientStops As Office.GradientStops
Set gssGradientStops = Selection.Font.Fill.GradientStops

GradientStyle returns the gradient style for the specified fill.

Dim mgsGradientStyle As Office.MsoGradientStyle
mgsGradientStyle = Selection.Font.Fill.GradientStyle

GradientVariant returns the gradient variant for the specified fill as an integer value from 1 to 4 for most gradient fills.

Dim lngGradientVariant As Long
lngGradientVariant = Selection.Font.Fill.GradientVariant

Parent returns an object that represents the parent object of the specified FillFormat object.

Dim objParent As Object
Set objParent = Selection.Font.Fill.Parent

Pattern returns or sets a MsoPatternType constant that represents the pattern applied to the specified fill or line.

Dim mptPattern As Office.MsoPatternType
mptPattern = Selection.Font.Fill.Pattern

PictureEffects returns a PictureEffects object that can be used to apply picture effects to the specified fill formatting.

Dim pesPictureEffects As Office.PictureEffects
Set pesPictureEffects = Selection.Font.Fill.PictureEffects

PresetGradientType returns the preset gradient type for the specified fill.

Dim mpgPresetGradientType As Office.MsoPresetGradientType
mpgPresetGradientType = Selection.Font.Fill.PresetGradientType

PresetTexture returns the preset texture for the specified fill.

Dim mptPresetTexture As Office.MsoPresetTexture
mptPresetTexture = Selection.Font.Fill.PresetTexture

RotateWithObject returns or sets whether the fill rotates with the specified shape.

Selection.Font.Fill.RotateWithObject =

TextureAlignment returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill.

Selection.Font.Fill.TextureAlignment =

TextureHorizontalScale returns or sets a Single that specifies the horizontal scaling factor for the texture fill.

Selection.Font.Fill.TextureHorizontalScale =

TextureName returns the name of the custom texture file for the specified fill.

Dim strTextureName As String
strTextureName = Selection.Font.Fill.TextureName

TextureOffsetX returns or sets a Long that specifies the horizontal offset of the texture from the origin in points.

Selection.Font.Fill.TextureOffsetX =

TextureOffsetY returns or sets a Long that specifies the vertical offset of the texture from the origin in points.

Selection.Font.Fill.TextureOffsetY =

TextureTile returns or sets whether the texture fill is tiled or centered.

Selection.Font.Fill.TextureTile =

TextureType returns the texture type for the specified fill.

Dim mttTextureType As Office.MsoTextureType
mttTextureType = Selection.Font.Fill.TextureType

TextureVerticalScale returns or sets a Single that specifies the vertical scaling factor for the texture fill.

Selection.Font.Fill.TextureVerticalScale =

Transparency returns or sets the degree of transparency of the specified fillfor a shape as a value between 0.0 (opaque) and 1.0 (clear).

Selection.Font.Fill.Transparency =

Type returns the shape fill format type.

Dim mftType As Office.MsoFillType
mftType = Selection.Font.Fill.Type

Visible true if the specified object, or the formatting applied to it, is visible.

Selection.Font.Fill.Visible =