Class Tab (Excel VBA)

The class Tab represents the tab of a chart or a worksheet.

Item

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

Dim tab as Tab
Set tab = ActiveChart.Tab

The following procedures can be used to set variables of type Tab: Chart.Tab and Worksheet.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.

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.

xlThemeColorAccent1 - Accent1, xlThemeColorAccent2 - Accent2, xlThemeColorAccent3 - Accent3, xlThemeColorAccent4 - Accent4, xlThemeColorAccent5 - Accent5, xlThemeColorAccent6 - Accent6, xlThemeColorDark1 - Dark1, xlThemeColorDark2 - Dark2, xlThemeColorFollowedHyperlink - Followed hyperlink, xlThemeColorHyperlink - Hyperlink, xlThemeColorLight1 - Light1, xlThemeColorLight2 - Light2.

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 =