Unique ID's are NOT matching up

Started by Dean, February 12, 2016, 09:44:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dean

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???

Surrogate

#1
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 like as "{2287DC42-B167-11CE-88E9-0020AFDDD917}", it is just ID

Dean

Oh I see.

How do I display an ID of a shape after clicking it?


Surrogate

you mean just once clicking or double clicking ?


Surrogate

#5
use Google Translate™ for read this thread in Russian forum

Dean

Spasiba :-) Thanks, Ill try it later and let you know