Styles.Item Method

Returns a specific Style object of a Styles collection.

Syntax

   Styles.Item StyleName
Parameter Description
StyleName

Specifies the name of the style. If this value does not match any existing member of the collection, an error occurs.

Return Value

The method returns a Style object.

Data Types

StyleName:    String
Return value:    Style Object

Limitations

Run time only.

Example

The first of the following Basic examples displays the name of the font used with the Headline formatting style. The second enumerates the names of all styles and its fonts in a document. In the third example, it is shown how to change a style property programmatically:

MsgBox TXTextControl1.Styles.Item("Headline").FontName

For Each style In TXTextControl1.Styles
   Debug.Print "Style name: " + style + ", Font name: " + style.FontName
Next

Set Style = TXTextControl1.Styles.Item(TXTextControl1.StyleCurrent)
Style.FontName = "Arial"
Style.FontSize = 400
Style.Apply

See Also