ColorIndex Property

Microsoft Office Web Components Object Model

Show All

ColorIndex Property

       

ColorIndex property as it applies to the Border object. 

Returns or sets the color of the border. The color is specified as an index value into the current color palette, or as a XlColorIndex constant. Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone
 

expression.ColorIndex

expression   Required. An expression that returns a Border object.

ColorIndex property as it applies to the Borders object. 

Returns or sets the color of all four borders. The color is specified as an index value into the current color palette, or as a XlColorIndex constant. Returns Null if all four borders aren't the same color. Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Borders object.

ColorIndex property as it applies to the Font object. 

Returns or sets the color of the font. The color is specified as an index value into the current color palette, or as XlColorIndex constant. Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Font object.

ColorIndex property as it applies to the Interior object. 

Returns or sets the color of the interior fill. The color is specified as an index value into the current color palette, or as a XlColorIndex constant. Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Interior object.

Remarks

This property specifies a color as an index into the workbook color palette. You can use the Colors method to return the current color palette.

The following illustration shows the color-index values in the default color palette.

Color index values in default color palette

Example

As it applies to the Font object.

This example changes the font color in cell A1 on Sheet1 to red.

Spreadsheet1.ActiveSheet.Range("A1").Font.ColorIndex = 3