Org Charts Auto-arrange in VBA


    Sponsored Links


  • 1. MIME types for Visio
    Hi everyone, This is more of a Visio web developer question! I have a visio compatible XML string that I want to flush to the client machine. I want to know how to set the MIME type and pass the XML string so that it opens it in VIsio on the client machine. I tried setting the "application/x-visio" in the response object's content type field, but that only tries to save it as an ASP.NET page! Well, I even tried registering the MIME type with IIS and setting the content type field to application/vnd.visio.xml. Then, in my application I do: Response.Clear(); Response.Charset = ""; Response.ContentType = "application/vnd.visio.xml"; But it still interprets it as a ASP page. I also tried "application/". That also did not work. When I use application/vnd.visio then it tries to interpret the document as the native Visio format :( Also, I noticed something with IE. Some macros and ActiveX creation within Visio do not work, even if user enables macro on prompt. What I wanted was to stream the visio content to the client, start an instance of visio and be able to use all the features. I do not want the IE to host Visio application inside. Guys, please help me! I would be in deep trouble. I should have looked at this before doing all this development! I would be even willing to pay some bucks to someone who helps here! Cheers! xargon
  • 2. Visio DrawingControl speed
    Hi all I found something interesting about Visio drawing Control and wonder if anybobody can tell the reason. If you have VB (or any other similar) installed, please follow this: (1) open Visio and start a blank drawing, draw a rectanglar shape, then format filling to color = 00, pattern = 26, pattern color = 01. This will give you something like a 3-D vessel. (2) copy this shape to maybe 20 or more. Then you can change the text for each "vessel". It is VERY FAST. Save the drawing to a file, say C:\test.vsd (3) start a new VB project. Add Visio 11.0 drawing control to the project components list. Now you drag the visio control to form1. Resize the form and control to make it big. (4) on Form1_Load event, just type one line: drawingControl1.src = "C:\test.vsd" (5) Run the VB project and you see the Drawing on the window. Now if you change text for each "Vessel", it becomes VERY SLOW. Anybody can explain why and give a solution to speed it up? Or is it a bug in the drawing control? Thanks. Andrew
  • 3. object_TextChanged(ByVal shape As IVShape)
    I have a Visio sheet that I am using as the front end of chemical process simulation. Visio has numbers created from its "Text Tool", i.e. the big A button on the Standard Tool Bar that are used to display flow rates. I would like to change those numbers in Visio and key off a change event to re-run my simulation. Does anyone know if this is possible or how? I've been attempting to use the below sub for a text change event, but do not know what to use for the "object". Private Sub object_TextChanged(ByVal shape As IVShape) -Mike
  • 4. Visio SaveAs woes!
    Hi everyone, I must say some of the things with the Visio program API is such a pain! I call the SaveAs method from within my VBA code and save my document as an XML document (with the vdx) extension. Now, the problem is that after I save it, visio loads the file. What I want to do is store the file in the hard disk, read it into a text string and delete it again! However, now I cannot delete it as Visio has loaded the document! Is there any way to tell visio not to load the document and just save a copy of it! Boy, getting old here! Cheers! xargon

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. Re-Layout and auto organization does not work in org chart

8. Move org chart without auto-rerouting

Return to VISIO


Who is online

Users browsing this forum: No registered users and 93 guest