How do I count subordinates under a manager in an organization ch.

D

Dweezil13

I'd like to find the number of direct reports for each mid-level manager and
the number of all members in an organization under a director.
 
C

Chris Roth [ Visio MVP ]

You can select all the shapes you are interested in, then type a simple line
of VBA code in the "Immediate" window in the VBA environment.

? Visio.ActiveWindow.Selection.Count

If you've done a net-selection around a whole bunch of shapes, then it will
be something more like:

? (Visio.ActiveWindow.Selection.Count - 1 ) / 2

That removes the connectors from the total, but this is more dodgy, because
you might have missed some of the connectors when selecting.

To count subordinates entirely by code, you'll have to analyze the
FromConnects collection of each shape, starting at the top. This is nice,
because you only need to specify the top shape to get everything underneath.
The FromConnects contains a collection of Connects objects, which let you
determine which connectors are attached to the shape. Then you can see which
shapes are on the other end of each connector, on down the line. It's a bit
more difficult, and I'm not sure that this is what you're looking for.

--

Hope this helps,

Chris Roth
Visio MVP
 
S

Scott Swan

Thanks, Chris. I played with it a little after I posted, and I came up
with the FromConnects method to navigate the tree. I'll use that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top