Class Tab (Excel VBA)

The class Tab represents the tab of a chart or a worksheet. To use a Tab class variable it first needs to be instantiated, for example


Dim tab as Tab
Set tab = ActiveChart.Tab

Color

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value.


ActiveChart.Tab.Color = RGB(0,0,255)'blue

ColorIndex

Returns or sets a value that represents the color of the specified worksheet tab or chart tab. Possible return values are xlColorIndexAutomatic - Automatic color, xlColorIndexNone - No color.

After a Tab object is returned, you can use the ColorIndex property to determine the settings of a tab for a chart or worksheet. The color is specified as an index value in the current color palette from 1 to 56 or the XlColorIndex value xlColorIndexNone.


ActiveChart.Tab.ColorIndex = xlColorIndexAutomatic

ThemeColor

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Here you can find possible values for XlThemeColor.

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.


ActiveChart.Tab.ThemeColor = xlThemeColorAccent1

TintAndShade

Returns or sets a Single that lightens or darkens a color.

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral. Attempting to set this property to a value less than -1 or more than 1 is not recommended. Excel will correct the value internally to some value that falls within the range of valid values. This property works for both theme colors and nontheme colors.


ActiveChart.Tab.TintAndShade =