StyleByName Method

Searches for a style with the specified name (the Name property) in the style collection of the document. Returns a Style object, that corresponds to the found style.

Applies to: Document object

Syntax

[[Set] styleRet =] object.StyleByName ( styleName )

The StyleByName method syntax has these parts:

Part Description
object Required. An expression, that returns a Document object.
styleName Required. An expression that returns a String value. The name (the Name property) of the style to be found.
styleRet Optional. A Style type variable.

Remarks

If there is no style with the specified styleName in the style collection of the document, the StyleByName method returns Nothing.

 

See Also

AddStyle method, FindStyle method, RemoveStyle method, RemoveStyleByName method, RenameStyle method, Style method, StylesNum method, Style object