Style Properties

Name

Returns

Description

AddIndent

Boolean

Set/Get whether text associated with the style is automatically indented if the text alignment in a cell is set to equally distribute

Borders

Borders

Read-only. Returns the collection of borders associated with the style. Each border side can be accessed individually

BuiltIn

Boolean

Read-only. Returns whether the style is built-in

Font

Font

Read-only. Returns an object containing Font options for the associated style

FormulaHidden

Boolean

Set/Get whether formulas associated with the style will be hidden if the workbook/worksheet is protected

Horizontal Alignment

XlHAlign

Set/Get how the cells associated with the style are horizontally aligned. Use the XlHAlign constants

IncludeAlignment

Boolean

Set/Get whether the styles include properties associated with alignment (that is, AddIndent, Horizonta-lAlignment, Vertical Alignment, WrapText, and Orientation)

Name

Returns

Description

IncludeBorder

Boolean

Set/Get whether border attributes are included with the style (that is, Color, ColorIndex, LineStyle, and Weight)

IncludeFont

Boolean

Set/Get whether font attributes are included in the style (that is, Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, OutlineFont, Shadow, Size, Strikethrough, Subscript, Superscript, and Underline)

IncludeNumber

Boolean

Set/Get whether the NumberFormat property is included in the style

Include Patterns

Boolean

Set/Get whether interior pattern related properties are included in the style (that is, Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex)

Include Protection

Boolean

Set/Get whether the locking related properties are included with the style (that is, FormulaHidden and Locked)

IndentLevel

Long

Set/Get the indent level for the style

Interior

Interior

Read-only. Returns an object containing options to format the inside area of the style (for example, interior color)

Locked

Boolean

Set/Get whether the style properties can be changed if the workbook is locked

MergeCells

Variant

Set/Get whether the current style contains merged cells

Name

String

Read-only. Returns the name of the style

NameLocal

String

Read-only. Returns the name of the style in the language of the user's computer

NumberFormat

String

Set/Get the number format associated with the style

NumberFormat Local

String

Set/Get the number format associated with the style in the language of the end user

Orientation

Orientation

Set/Get the text orientation for the cell text associated with the style. A value from -90 to 90 degrees can be specified or an XlOrientation constant

ReadingOrder

Long

Set/Get whether the text associated with the style is from right-to-left (xlRTL), left-to-right (xlLTR), or context sensitive (xlContext)

ShrinkToFit

Boolean

Set/Get whether the cell text associated with the style will automatically shrink to fit the column width

Name Returns

Description

Value String

Read-only. Returns the name of the style

Vertical Alignment XlVAlign

Set/Get how the cells associated with the style are vertically aligned. Use the XlVAlign constants

WrapText Boolean

Set/Get whether cell text wraps in cells associated with the style

Style Methods

Name Returns

Parameters Description

Delete Variant

Deletes the style from the collection

Style Object and the Styles Collection Example

Sub UpdateStyles()

Dim oStyle As Style

Set oStyle = ActiveWorkbook.Styles("Accent4")

'Update the Editing style to be unlocked with a default background With oStyle

.IncludePatterns = True .IncludeProtection = True .Locked = False .Interior.Pattern = xlNone End With End Sub

Sub UpdateStyles()

Dim oStyle As Style

Set oStyle = ActiveWorkbook.Styles("Accent4")

'Update the Editing style to be unlocked with a default background With oStyle

.IncludePatterns = True .IncludeProtection = True .Locked = False .Interior.Pattern = xlNone End With End Sub

0 0

Post a comment