I dragged and dropped shapes into a blank Visio page. They auto ID into the following which I check through the "shape name" tab:
Quote1
24
47
51
48
(as a side discussion can anyone explain why this is not serialised, it seems quasi random to me)
I then write and execute the following macro:
Public Sub GetIDs_Example()
Dim vsoSelection As Visio.Selection
Dim lngShapeIDs() As Long
Dim lngShapeID As Long
ActiveWindow.DeselectAll
ActiveWindow.SelectAll
Set vsoSelection = ActiveWindow.Selection
Call vsoSelection.GetIDs(lngShapeIDs)
For lngShapeID = LBound(lngShapeIDs) To UBound(lngShapeIDs)
Debug.Print lngShapeID
Next
End Sub
The output of the macro is printed in the immediate window command prompt as the following:
Quote
0
1
2
3
4
How come the ID numbers are not the same???
Debug.Print lngShapeID
you just iterate array, and print count !
For i = 1 To vsoSelection.Count
Debug.Print vsoSelection(i).ID
Next
PS it is NOT Unique ID (https://msdn.microsoft.com/en-us/library/office/ff767736.aspx) like as "{2287DC42-B167-11CE-88E9-0020AFDDD917}", it is just ID (https://msdn.microsoft.com/EN-US/library/office/ff767467.aspx)
Oh I see.
How do I display an ID of a shape after clicking it?
you mean just once clicking or double clicking ?
Once
use Google Translateā¢ for read this thread in Russian forum (https://translate.google.com/translate?hl=ru&sl=ru&tl=en&u=http%3A%2F%2Fwww.cyberforum.ru%2Fvba%2Fthread1429395.html)
Spasiba :-) Thanks, Ill try it later and let you know