Selection.GetIDs method (Visio)
Gets the shape IDs of the shapes in the selection.
Note
This Visio object or member is available only to licensed users of Visio Professional 2013.
Syntax
expression.GetIDs(ShapeIDs())
expression An expression that returns a Selection object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
ShapeIDs() | Required | Long | Out parameter. An array of shape IDs of type Long corresponding to the shapes in the selection. |
Return value
Nothing
Remarks
Microsoft Visio uses ID numbers to identify shapes, recordsets, and data rows. Shape IDs are unique only within the scope of the page they are on. After you determine these shape IDs, you can pass them to the Page.LinkShapesToDataRows method to specify exactly how the shapes in your diagram should link to data rows in the available data recordsets. Shape IDs are unique within the scope of a particular page.
To determine the shape ID for a shape that is part of a selection, use the Selection.GetIDs method.
The set of shape IDs returned is determined by the setting of the Selection.IterationMode property.
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetIDs method to get the IDs of shapes in a selection and print the IDs in the Immediate window. It selects all the shapes in the active window.
Public Sub GetIDs_Example()
Dim vsoSelection As Visio.Selection
Dim lngShapeID As Long
Dim intShapeIndex As Integer
ActiveWindow.DeselectAll
ActiveWindow.SelectAll
Set vsoSelection = ActiveWindow.Selection
Call vsoSelection.GetIDs(lngShapeIDs)
For intShapeIndex = LBound(lngShapeIDs) To UBound(lngShapeIDs)
lngShapeID = lngShapeIDs(intShapeIndex)
Debug.Print lngShapeID
Next
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.