Styles Property [Visio 2003 SDK Documentation]

Returns the Styles collection for a document.

objRet = object**.Styles**

objRet     The Styles collection of the Document object.

object     Required. An expression that returns a Document object.

Version added

2.0

Example

The following macro shows how to use the Styles property to add Style objects to the Styles collection. It shows how to add a new style based on an existing style as well as how to add a new style created from scratch.

Public Sub Styles_Example()
 
    Dim vsoDocument As Visio.Document 
    Dim vsoStyles As Visio.Styles 
    Dim vsoStyle As Visio.Style 

    'Add a document based on the Basic Diagram template. 
    Set vsoDocument = Documents.Add("Basic Diagram.vst") 

    'Add a style named "My FillStyle" to the Styles collection. 
    'This style is based on the style Basic Shadow and includes 
    'only a Fill style. 
    Set vsoStyles = vsoDocument.Styles 
    Set vsoStyle = vsoStyles.Add("My FillStyle", "Basic Shadow", 0, 0, 1) 

    'Add a style named "My NoStyle" to the Styles collection. 
    'This style is not based on an existing style and includes 
    'Text, Line, and Fill styles. 
    Set vsoStyle = vsoStyles.Add("My NoStyle", "", 1, 1, 1)
 
End Sub

Applies to | Document object

See Also | Style object | Styles collection