MAcro to show the ID of a shape

Started by slouw, December 19, 2018, 02:41:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

slouw

I want to develop a macro to do things to selected shape(s).
First things first very newby.
I want to write  a macro to show the shape id of all selected shapes.
I have butchered something I found off the web as below but it is not working.
Any help greatly appreciated

' Select Shapes: This is a piece of sample code that shows how to work with the currently selected shapes.
' from John Marshall
' http://visio.mvps.org/vba/default.html
Sub With_Sectection_Do_something()
    Dim VsoSelect As Visio.Selection
    Dim VsoShape As Visio.Shape
    Dim xx
    xx = 10
    Set VsoSelect = Visio.ActiveWindow.Selection
    If VsoSelect.Count > 0 Then
    For Each VsoShape In VsoSelect
        MsgBox "VsoSelect :" & xx                           ' This works
        ' MsgBox "VsoSelect :" & VsoSelect.Item.ID  ' This does not....
    Next VsoShape
    Else
        MsgBox "You Must Have Something Selected"
    End If
End Sub

Surrogate

MsgBox "VsoSelect :" & VsoSelect.Item.ID  change to         MsgBox "VsoSelect :" & VsoShape.ID  ' Just chek my advive