Viewer.LayerName Property (Visio Viewer)

Gets the name of the layer at the specified index in the drawing open in Microsoft Visio Viewer. Read-only.


expression. LayerName(LayerIndex)

_expression_An expression that returns a Viewer object.


Name Required/Optional Data Type Description
LayerIndex Required Long The index of the layer in the collection of layers in the drawing open in Visio Viewer.

Return Value



The collection of layers is one-based, so the index of the first layer in the collection is 1. If there are no layers in the drawing, or if there is no layer at index position LayerIndex, the LayerName property returns nothing.


The following code gets the name of all the layers in the drawing open in Visio Viewer.

Dim intCounter As Integer

For intCounter = 1 To vsoViewer.LayerCount

    Debug.Print vsoViewer.LayerName(intCounter)

Next intCounter