TXTextControl.Styles.Item Method

Returns a specific Style object of a Styles collection.


   Styles.Item StyleName
Parameter Description

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


Run time only.


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

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

See Also