Style property (Shape object)

Microsoft Visio Developer Reference

Style property (Shape object)

   Example   

Gets or sets the style for a Shape 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 Shape 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 shape. (Earlier versions generate a "no such style" exception.) If the shape 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).