VBA code to get Shape ID

Started by nilani, September 05, 2011, 01:46:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nilani

Hi,
Can anybody please tell me a VBA code to get Shape IDs in shapes on the visio drawing page? Thank you.

Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Jumpy


Sub NameList()
  Dim shp as Visio.Shape

  For each shp in ActivePage.Shapes
    MsgBox shp.Name & vbCrLf & _
                shp.NameU & vbCrLf & _
                shp.NameID & vbCrLf & _ 
                shp.ID
  Next shp
End Sub

DJozef87

Thanks Jumpy for this code. Just can we adapt it to only selected shapes instead of all shapes

Jumpy

Just change one line:

For each shp in ActiveWindow.Selection

nilani

Hi everybody,

I was unable to log in to Visio guy yesterday due to a technical problem >:( only now I got the chance  :D Thank you very much for your replies. Code is very much useful.

DJozef87


febbert

No reply necessary anyone, just want to boost this post. 

Trying to find a concise code snippet of  looping through a selection of shapes has been maddening.   I've been programming for 30 years, written a few things.  Properly conceptualizing the document model for Visio has been challenging to say the least.  Adobe's document model, AutoLISPs dotted pairs model, MS Access VBA document model have all been easier to grasp and use than Visio's.

Thank you sooooo much for having shared this information.