Counting no of items for each Layer

Started by diwakaramit, October 16, 2022, 07:35:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

diwakaramit

Hello -

I am trying to create a Macro that can generate a list of layer name and no of items associated with each layer. For example, in the attached visio sample has one page "Page-1" but in reality i could have 100 pages.
In the sample when i open the layer properties i see one layer "4-014A" that has zero shapes/items associated. I will have to delete this layers. But i will have to do this manual task on 100 pages, instead I am looking to generate a list that will give me all the layer name and associated page that have zero shapes/items associated with that layer. Is it possible to do as a macro? i tried using "Layer.Shapes.Count" but it looks like this is not in VBA library. So what is the command prompt i could use?

P.S : i know the layers are not aligned on the page currently but this is just a sample so the actual visio page actually looks different

Thank you very much


wapperdude

#1
See the following.  In 1st link, Look at Nikolay's suggestuion. 
In second link, A more detailed code example.  At the end, there's discussion re using local vs universal naming.

http://visguy.com/vgforum/index.php?topic=8920.msg39174#msg39174
https://stackoverflow.com/questions/72550038/getting-the-number-of-shapes-with-in-a-layer-on-visio-using-vba
Visio 2019 Pro

diwakaramit

Thank you so much.  This was really helpful