Class Style (Excel VBA)

The class Style represents a style description for a range.

The classes DisplayFormat, Range and Slicer. give access to class Style


Dim sty as Style
Set sty = ActiveCell.Style

For Each

Here is an example of processing the Style items in a collection.


Dim sty As Style
For Each sty In Application.Styles
	
Next sty

Methods

Delete - Deletes the object.

Properties

Value (Default member) - Returns a String value that represents the name of the specified style.

AddIndent returns or sets a Boolean value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically).

Borders returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).

BuiltIn true if the style is a built-in style.

Font returns a Font object that represents the font of the specified object.

FormulaHidden returns or sets a Boolean value that indicates if the formula will be hidden when the worksheet is protected.

HorizontalAlignment returns or sets an XlHAlign value that represents the horizontal alignment for the specified object.

IncludeAlignment true if the style includes the AddIndent, HorizontalAlignment, VerticalAlignment, WrapText, IndentLevel, and Orientation properties of the Style object.

IncludeBorder true if the style includes the Color, ColorIndex, LineStyle, and Weight properties of the Border object.

IncludeFont true if the style includes the Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, Size, Strikethrough, Subscript, Superscript, and Underline font properties.

IncludeNumber true if the style includes the NumberFormat property.

IncludePatterns true if the style includes the Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex properties of the Interior object.

IncludeProtection true if the style includes the FormulaHidden and Locked protection properties.

IndentLevel returns or sets a Long value that represents the indent level for the style.

Interior returns an Interior object that represents the interior of the specified object.

Locked returns or sets a Boolean value that indicates if the object is locked.

MergeCells true if the style contains merged cells.

Name returns a String value that represents the name of the object.

NameLocal returns or sets the name of the object, in the language of the user.

NumberFormat returns or sets a String value that represents the format code for the object.

NumberFormatLocal returns or sets a String value that represents the format code for the object as a string in the language of the user.

Orientation returns or sets an XlOrientation value that represents the text orientation.

ReadingOrder returns or sets the reading order for the specified object. Can be one of the following XlReadingOrder constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext.

ShrinkToFit returns or sets a Boolean value that indicates if text automatically shrinks to fit in the available column width.

VerticalAlignment returns or sets an XlVAlign value that represents the vertical alignment of the specified object.

WrapText returns or sets a Boolean value that indicates if Microsoft Excel wraps the text in the object.

Borders - A collection of four Border objects that represent the four borders of a Range object or Style object.

Font - Contains the font attributes (font name, font size, color, and so on) for an object.

Interior - Represents the interior of an object.