Visio Guy

Visio Discussions => Programming & Code => Topic started by: lecrick on March 06, 2018, 09:59:37 AM

Title: [SOLVED]Count Shapes in multiple Containers For Each Pages
Post by: lecrick on March 06, 2018, 09:59:37 AM
Hello Guys!!

I need your help!

So like the title said, i have multiple Containers which contains multiple shapes. I have the same pattern on many pages.
What I want to do is count shapes in each containers to repositionning those in their container according to their numbers with a select case.
It should be something like this right? :


For Each Page in this document
  For Each Containers in this page
      Count Shapes
      Select Case Count Shapes
               Case Is = 1
                   'code
               Case Is = 2
                   'code
               'and so on
      End Select
  Next Container
Next Page


VBA is very new for me and i can't manage to code this properly, so can someone help me?

Thx
Title: Re: Count Shapes in multiple Containers For Each Pages
Post by: wapperdude on March 12, 2018, 03:01:24 PM
Google is your friend:

Here are some references...
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/select-case-statement (https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/select-case-statement)

https://www.exceltrick.com/formulas_macros/vba-select-case-statement/ (https://www.exceltrick.com/formulas_macros/vba-select-case-statement/)

http://www.bluepecantraining.com/portfolio/excel-vba-select-case-structure/ (http://www.bluepecantraining.com/portfolio/excel-vba-select-case-structure/)

Those should get you started.

Wapperdude
Title: Re: Count Shapes in multiple Containers For Each Pages
Post by: lecrick on March 20, 2018, 03:29:34 PM
Thanks wapperdude,

But I finally did something completely different with the auto align and auto space, and it did what i wanted.
:)