Style property (Selection object)

Microsoft Visio Developer Reference

Style property (Selection object)

   Example   

Gets or sets the style for a Selection object.

Version added

2.0

Syntax

strRet = object.Style
object.Style = stringExpression

strRet

String. The fill style component of the style.

object

Required. An expression that returns a Selection object that has or gets the style.

stringExpression

Required String. The name of the style to apply.

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style. If you set the Style property to a nonexistent style, your program generates an error.

To preserve local formatting, use the StyleKeepFmt property.

Beginning with Visio 2002, an empty string ("") will cause the master's style to be reapplied to the selection. (Earlier versions generate a "no such style" exception.) If the selection has no master, its style remains unchanged. Setting stringExpression to an empty string is the equivalent of selecting Use master's format in the Text style, Line style, or Fill style list in the Style dialog box (on the Format menu, click Style).