Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.62 KB

Excel.ColorFormat.md

File metadata and controls

65 lines (48 loc) · 2.62 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ColorFormat object (Excel)
vbaxl10.chm105000
vbaxl10.chm105000
Excel.ColorFormat
9bb6bc1f-9886-d290-a336-068f84cad1a9
03/29/2019
medium

ColorFormat object (Excel)

Represents the color of a one-color object, the foreground or background color of an object with a gradient or patterned fill, or the pointer color.

Remarks

You can set colors to an explicit red-green-blue value (by using the RGB property) or to a color in the color scheme (by using the SchemeColor property).

Use one of the properties listed in the following table to return a ColorFormat object.

Use this property With this object To return a ColorFormat object that represents this color
BackColor FillFormat The background fill color (used in a shaded or patterned fill)
ForeColor FillFormat The foreground fill color (or simply the fill color for a solid fill)
BackColor LineFormat The background line color (used in a patterned line)
ForeColor LineFormat The foreground line color (or just the line color for a solid line)
ForeColor ShadowFormat The shadow color
ExtrusionColor ThreeDFormat The color of the sides of an extruded object

Example

Use the RGB property to set a color to an explicit red-green-blue value. The following example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

Set myDocument = Worksheets(1) 
With myDocument.Shapes.AddShape(msoShapeRectangle, _ 
 90, 90, 90, 50).Fill 
 .ForeColor.RGB = RGB(128, 0, 0) 
 .BackColor.RGB = RGB(170, 170, 170) 
 .TwoColorGradient msoGradientHorizontal, 1 
End With

Properties

See also

[!includeSupport and feedback]