Org Charts Auto-arrange in VBA


    Sponsored Links


  • 1. Linking Shapes
    Hi Everybody I have a shape A on Page-1 and i want to link its custom property with shape B Which is on Page-2. i could not understand how i set the formula in the shapesheet which refer to other page Shapes Please Help. Thanks.
  • 2. Associate text with certain positions on org chart
    Using Visio 2002 SP2. Is there a way to attach or associate text to a shape; perhaps something like a cell note in MS-Excel? Or is there a built-in note pad one could open where some textual notes could be added about a shape? The reason is, we are looking at developing an org chart, but for some positions we would like to add some notes about the positions; e.g. for justifications, approvals, under filled positions, promotions, demotions, lateral moves, etc. These notes could be rather long, and I'm presuming, not appropriate for a custom property of the shape? How long can a custom property be? We could need up to say about the equivalent of one page in a MS-Word document at Arial 10-point font with half-inch margins. If this is built-in, how do I access it? If not built-in, any suggestions on creating something using VBA? Should I consider hyperlinking to separate MS-Word documents? Ideas? Thanks much in advance.
  • 3. Connect two shapes together
    Hi, I would like to know if it is possible to create a VBA macro for visio which allows a user to select two shapes and click a button which executes a macro that connects the two shapes together. Is it possible to pass information about the selected shapes to the macro? How would I do this? Thanks
  • 4. General Visio question
    I and my org are new to VISIO; my forte is VBA programming primarily in MS-Excel, but I also use MS-Access a lot and I also am coming up to speed rapidly using VBScript. Question: Is it possible to program VISIO in combination with Excel and/or Access so that given VISIO org charts (for each department/division), users could make edits and when done, their changes could be captured and written into a spreadsheet or DB table using VBA (i.e. automated data capture)? The type of information to capture would be: Employee Name; Department; Subdivision; Answers To (based on structure of org chart); Pay Grade; Title; Employee Status (i.e. Full/Part time; temp; etc.). I picture this info in a box for each employee on a separte org chart for each Dept. and/or Subdivision. Is this a realistic goal? Or would this be a very difficult/impossible task? The main problem I see is parsing the information as it is captured from each box; e.g. where does the Division name end and the Job Title begin, etc? Thanks much for your input.
  • 5. Guru Question Visio 2007 Auto Generate Shapes according to data so
    Hi, I was hoping someone might be able to tell me how I get visio to automatically insert a shape according to an excel spreadsheet or sql database. IE: I have 400 servers I want to put on a visio drawing. All these servers have a unique server name that I would like the shape to have as it's text name. Is it possible to create some kind of automatic generation of shapes according to the number of records contained in a data source and spit them out on a page. EG: Data Source Server1 Server2 Server3 Then 3 server shapes are automatically placed on a visio document called server1, server2, server3 I hope someone can help! 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 87 guest