Viewer.OnSelectionChanged event (Visio Viewer)

Occurs when the shape selection is changed in Microsoft Visio Viewer.

Syntax

expression.OnSelectionChanged (ShapeIndex)

expression An expression that returns a Viewer object.

Parameters

Name Required/Optional Data type Description
ShapeIndex Required Long The index of the newly selected shape.

Return value

Nothing

Remarks

The collection of shapes in the Viewer is one-based, so the first shape in the collection has an index of 1.

You can change the selected shape in Visio Viewer programmatically by using the SelectShape method.

Example

The following code shows how to use the OnSelectionChanged event to print the ID of the newly selected shape in Visio Viewer in the Immediate window.

Private Sub vsoViewer_OnSelectionChanged(ByVal ShapeIndex As Long)

    Debug.Print "Selected shape changed to shape " & vsoViewer.SelectedShapeIndex & "."

End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.