Colors Property [Excel 2003 VBA Language Reference]

Returns or sets colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Variant.


expression Required. An expression that returns a Workbook object.

Index   Optional Variant. The color number (from 1 to 56). If this argument isn't specified, this method returns an array that contains all 56 of the colors in the palette.


This example sets the color palette for the active workbook to be the same as the palette for Book2.xls.

ActiveWorkbook.Colors = Workbooks("BOOK2.XLS").Colors

This example sets color five in the color palette for the active workbook.

ActiveWorkbook.Colors(5) = RGB(255, 0, 0)

Applies to | Workbook Object

See Also | ColorIndex Property