Programmatic Control of Org Chart Menu Items?

D

Dave Paz

Is there a way to programmatically initiate any of the menu items on the
Organization Chart menu? I have a macro that creates an org chart from a
data file. I then make some changes and want to execute a Re-layout. I
don't know how to get the macro to do a Re-layout or Best Fit to Page. If I
record a macro and execute the menu commands interactively, nothing gets
recorded in the macro.

Any help or pointers would be appreciated.

Thanks,
Dave
 
C

Chris Roth [MVP]

Hi Dave,

Two ideas:

One, you can analyze the Orgchart menu via Visio's UI object to see what the
commands are. Since I don't do this sooo often, I always forget and find it
a bit of a pain...just laziness really.

Two, select an orgchart shape and choose Window > Show ShapeSheet. In the
Actions section, you'll see a bunch of formulas with RUNADDONWARGS. The
add-on is called OrgC11, and you can see a whole slew of parameters that can
be fed to it.

Looking at this, I took a lucky guess and figured "/cmd=LayoutPage" would do
what you needed. Sure enough it works. So you can test in VBA using this
line of code:

Call Visio.Application.Addons.ItemU("OrgC11").Run("/cmd=LayoutPage")



Also, here is a site for running the org-chart wizard from the command line:
http://rcm.amazon.com/e/cm?t=wander..._blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr

I don't think the parameters match up one-to-one with the calls to the
add-on from the ShapeSheet or via automation.

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 

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