Org Charts Auto-arrange in VBA


    Sponsored Links


  • 1. Visio 2003. Where are the macro for the masters?
    Dear all, I am new at VBA programming with Visio. We have inherited a list of masters and stencils for Visio 2003 that interface to a Macro to generate excel spreadsheets. All our masters have Custom Properties set. Now, we need to update these masters. I am able to edit and create new masters or amend existing custom properties but some of these masters have a sort of "intelligence". In other words, if I change property #1, I see property #3 automatically changed). I know that there are better way to obtain the same result, but that's what we get from the past. I would like to know: where is the software, the VBA, the macro - master dependent that allows this property 3 to be changed following property 1? Many thanks for your reply. Cheers, Fabian
  • 2. Run Reports Addon
    Hi there, I've been trying to automate the Reports... function in the Tools menu and have managed to run the Reporter addon with: Application.Addons("REPORTER.EXE").Run ("") But can anyone tell me if I can pass it an arguement such as the report name to run and to output to Excel, or html etc.? Thanks in advance John
  • 3. Grey Out in VBA menu
    Hi, I create a VBA menu, inside a VSS file. In my document, the menu is all the time in gray, impossible to activate. Following my code, thanks to help me. Dim AUIObject As Visio.UIObject Dim AMenuSet As Visio.MenuSet Dim AMenuItems As Visio.MenuItems Dim AMenuItem As Visio.MenuItem Dim AMenu As Visio.Menu 'Get the UI object for the copy of the MSOffice Menus Set AUIObject = Visio.Documents.Application.BuiltInMenus '(visMenuMSOffice) 'Get the Drawing Window Menusets 'NOTE: Use ItemAtID to get the Menuset. 'Using uiObj.MenuSets(visUIObjSetDrawing) will not work. Set AMenuSet = AUIObject.MenuSets.ItemAtID(visUIObjSetDrawing) Set AMenu = AMenuSet.Menus.Add AMenu.Caption = "MyMenu" 'Get the MenuItems collection Set AMenuItems = AMenu.MenuItems 'Add a new button in the first position Set AMenuItem = AMenuItems.AddAt(0) 'Set the properties for the new Menu button AMenuItem.CmdNum = 0 AMenuItem.Caption = "Activate MyMenu" AMenuItem.AddOnName = "ThisDocument.ConnectMyMenu" 'ConnectMyMenu it's my macro AMenuItem.ActionText = "Run MyMenu" AMenuItem.Enabled = True Application.SetCustomMenus AUIObject ActiveDocument.SetCustomMenus AUIObject
  • 4. Refresh of page tabs
    Depending upon the mode of my application I am changing the visibility of some of the page tabs from VBA. This works fine, apart from the fact that the page tabs are not refreshed. Does anyone know if there is there a way to force the refresh of the page tabs without changing to a different page an back again. Thanks
  • 5. Adding builtin commands to a commandbar
    I have created a commandbar from vba and wish to add some of the built-in commands. Are there any constants defined for the built-in commands, for example Zoom In. I created a macro and added Zoom In to the command bar. Looking at the generated code, it adds a control with ID=444. Obviously this isn't ideal from a maintenance point of view. Thanks

Org Charts Auto-arrange in VBA

Postby peter.allan » Thu, 28 Sep 2006 18:05:24 GMT

Hello, I'm trying to automate the creation of org-charts using Visio
VBA. I can create the org charts and do a certain amount of
manipulation, however I am struggling to "re-arrange" the shapes on the
page once the chart has been created.

The Org Chart Wizard tends to put subordinates in 2 columns below a
Manager, even where there are 30 or 40 subordinates and the shapes run
off the bottom of the pages. Manually I can improve this by selecting
the Manager, going to Shape -> Actions -> Arrange subordinates on the
menu, and clicking on the relevant button to re-arrange the shapes into
4 columns.

So is there any way I can run this 'auto-arrange' option in VBA ? I
cannot find anything in the Language References on the Microsoft site.

Even better would be some examples of how I can 'move' shapes around
the page more generally so I can move into (for example) 6 columns.

I have also seen reference on here to changing the orgch_u.vst file,
however I don't have one on my pc (I'm using Visio 2000), and I don't
know if it would help in this case anyway.

Any help is greatly appreciated,

RE: Org Charts Auto-arrange in VBA

Postby SnVuZVRoZVNlY29uZA » Thu, 28 Sep 2006 20:50:01 GMT

Sometimes you can get the name of command and parameter
by analysing the menu with vba, though it is not always true.


Re: Org Charts Auto-arrange in VBA

Postby Chris Roth [MVP] » Wed, 04 Oct 2006 20:16:55 GMT

Hi Peter,

I found one of my posts from a few weeks ago related to this topic, and have 
pasted it below. Have a look!

Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:

Org Chart Commands
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")

Re: Org Charts Auto-arrange in VBA

Postby peter.allan » Sat, 14 Oct 2006 19:01:08 GMT

Hi Chris,

Thanks for your reply. Regarding the info in your post - when I look at
the ShapeSheet for the employees in my Org Chart the RUNADDONWARGS
seems to be different from yours - there is no add-on called "orgc11",
and no /cmd=Layoutpage option. The only add-on is "orgc".

Do I need to get a new version of Visio (I'm currently using Visio Pro
2002 SR-1) ?

Or is this "orgc11" add-on downloadable, or installable, somehow ?

Thanks very much for any help,

Re: Org Charts Auto-arrange in VBA

Postby John Marshall, MVP » Sun, 15 Oct 2006 04:45:27 GMT

isio 2003's version number is 11, so orgc11 would be for Visio 2003.

John... Visio MVP

Need stencils or ideas?
Need VBA examples?
Visio Wishlist

< XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

Similar Threads: org chart pictures/hyperlinks from database?

I'm creating an org chart in Visio 2003 that is linked to a database.
I can get the employee data to update in the chart but I would like to
get the inserted pictures and hyperlinks to update based on a path/etc.
contained in database fields.  I've been digging through the Visio
developer help but haven't come up with much so far.  Any help would be


2.Org Chart or Flow Chart Control


Can someone recommend a Org Chart or a Flow Chart Control which I could use 
with vbs?

I would only use the control to display a chart. Functions for modifications 
like an Editor is not a need.


3.Insert Picture in Org. Chart - VBA

How can i insert any picture to any shape in org. chart 
with VBA? 
Could i link picture from Access database?

4.Org Chart Data Import using VBA?

I would be very interested in that code, as that is what I am trying to

Dan Sears wrote:
> I wrote some VBA code in MS Access to create an org chart with VISIO
> using the import feature.
> I use tables in the Access app to supply the data. I open Visio from
> VBA, drop the top manager, then drop the rest of the employees in
> proper positions based on the "ReportsTo" field. If you're interested
> could e-mail you a copy of the mbd.
>     Dan Sears
> "Randal Greene" < XXXX@XXXXX.COM > wrote in message
> news:OnnftUsqBHA.1596@tkmsftngp07...
> > I'd like to automate creating an org chart using data we have in
> > Access/SQL HR app.  Visio has a simple feature for
importing/exporting org
> > data via csv, however I can't seem to access the org data
> > feature using VBA.  Is this possible?  If not, I am new to Visio
VBA, so
> > what is the basic approach to creating the org chart object by
> using
> > code - do you use the Shapes collection?
> >
> > Thanks in advance...
> >
> > org chart pictures/hyperlinks from database?

I'm creating an org chart in Visio 2003 that is linked to a database.
I can get the employee data to update in the chart but I would like to
get the inserted pictures and hyperlinks to update based on a path/etc.
contained in database fields.  I've been digging through the Visio
developer help but haven't come up with much so far.  Any help would be


6. Auto arrange child shapes in parent shape

7. Move org chart without auto-rerouting

8. Auto change position type using custom properties in Org chart

Return to VISIO


Who is online

Users browsing this forum: No registered users and 80 guest