• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3219
  • Last Modified:

Possible to automatically Arrange Subordinates (re-layout) Visio 2003 org chart shapes in the Org Chart stencil

Is it possible to change the org chart's default layout to a vertical layout using the macros created by an EE super guru expert?

Below are examples of the end layout I'd like to achieve.

Thank you!

In previous questions, a macros converted a list of hyperlinks into an org chart then changed the standard org chart shapes into custom shapes.
http://www.experts-exchange.com/Microsoft/Applications/Microsoft_Visio/Q_26720393.html
http://www.experts-exchange.com/Microsoft/Applications/Microsoft_Visio/Q_26727946.html
http://www.experts-exchange.com/Microsoft/Applications/Microsoft_Visio/Q_26830146.html



 Replace-Org-Chart-Shapes-v04-1-.vsd Replace-Org-Chart-Shapes-v04-1-.vsd org-chart-after-macros-v04.vsd Desired vertical layout
0
radiantjoy
Asked:
radiantjoy
  • 8
  • 6
  • 2
1 Solution
 
Visio_GuyCommented:

I've gone through Visio 2007's orgchart menus and toolbars and compiled a list of the add-ons and arguments that are connected with each menu item and toolbar button.

So for example, if  a shape is selected in the drawing window, you could execute a layout command for stacking subordinates vertically like this:

Call visio.Application.Addons("OrgC11").Run("/toolbar_vert1")

Here's the list:

Org Chart Menu Items
---------------------
Caption:        Re-&layout
Add-on:         OrgC11
Add-on args:    /relayout

Caption:        Best &Fit to Page
Add-on:         OrgC11
Add-on args:    /fittopage

Caption:        A&rrange Subordinates...
Add-on:         OrgC11
Add-on args:    /layoutdlg

Caption:        Hide Su&bordinates
Add-on:         OrgC11
Add-on args:    /hidesubordinates

Caption:        &Move Subordinates
Add-on:        
Add-on args:    

Caption:        Change &Position Type...
Add-on:         OrgC11
Add-on args:    /convertshapes

Caption:        &Synchronize
Add-on:        
Add-on args:    

Caption:        &Import Organization Data...
Add-on:         OrgCWiz
Add-on args:    /AddToOldDrawing

Caption:        E&xport Organization Data...
Add-on:         OrgC11
Add-on args:    /exportorgdata

Caption:        &Compare Organization Data...
Add-on:         OrgC11
Add-on args:    /diffcompare

Caption:        C&hange Spacing...
Add-on:         OrgC11
Add-on args:    /editalprops

Caption:        &Options...
Add-on:         OrgC11
Add-on args:    /editoverallprops


Org Chart Toolbar Items
---------------------
Caption:        Re-layout
Add-on:         OrgC11
Add-on args:    /relayout

Caption:     Horizontal Layout (6 items)

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1


Caption:     Vertical Layout (6 items)

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1


Caption:     Side By Side (6 items)

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2


Caption:        Move Left
Add-on:         OrgC11
Add-on args:    /shiftleft

Caption:        Move Right
Add-on:         OrgC11
Add-on args:    /shiftright

0
 
Visio_GuyCommented:
Moderators: please delete my previous post, it had errors. There doesn't seem to be a way for me to edit my posts.

I've gone through Visio 2007's orgchart menus and toolbars and compiled a list of the add-ons and arguments that are connected with each menu item and toolbar button.

So for example, if  a shape is selected in the drawing window, you could execute a layout command for stacking subordinates vertically like this:

Call visio.Application.Addons("OrgC11").Run("/toolbar_vert1")

Here's the list:

Org Chart Menu Items
---------------------
Caption:        Re-&layout
Add-on:         OrgC11
Add-on args:    /relayout

Caption:        Best &Fit to Page
Add-on:         OrgC11
Add-on args:    /fittopage

Caption:        A&rrange Subordinates...
Add-on:         OrgC11
Add-on args:    /layoutdlg

Caption:        Hide Su&bordinates
Add-on:         OrgC11
Add-on args:    /hidesubordinates

Caption:        &Move Subordinates
Add-on:        
Add-on args:    

Caption:        Change &Position Type...
Add-on:         OrgC11
Add-on args:    /convertshapes

Caption:        &Synchronize
Add-on:        
Add-on args:    

Caption:        &Import Organization Data...
Add-on:         OrgCWiz
Add-on args:    /AddToOldDrawing

Caption:        E&xport Organization Data...
Add-on:         OrgC11
Add-on args:    /exportorgdata

Caption:        &Compare Organization Data...
Add-on:         OrgC11
Add-on args:    /diffcompare

Caption:        C&hange Spacing...
Add-on:         OrgC11
Add-on args:    /editalprops

Caption:        &Options...
Add-on:         OrgC11
Add-on args:    /editoverallprops


Org Chart Toolbar Items
---------------------
Caption:        Re-layout
Add-on:         OrgC11
Add-on args:    /relayout

Caption:     Horizontal Layout (6 items)

 0
    Caption:        Center
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz1

 1
    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz2

 2
    Caption:        Align Right
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz3

 3
    Caption:        Stagger
    Add-on:         OrgC11
    Add-on args:    /toolbar_horiz6


Caption:     Vertical Layout (6 items)

 0
    Caption:        Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert1

 1
    Caption:        Align Right
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert3

 2
    Caption:        Staff Align Left
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert5

 3
    Caption:        Staff Align Right
    Add-on:         OrgC11
    Add-on args:    /toolbar_vert6


Caption:     Side By Side (6 items)

 0
    Caption:        Single Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside2

 1
    Caption:        Single Top
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside1

 2
    Caption:        Double Side
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside4

 3
    Caption:        Double Top
    Add-on:         OrgC11
    Add-on args:    /toolbar_sidebyside3


Caption:        Move Left
Add-on:         OrgC11
Add-on args:    /shiftleft

Caption:        Move Right
Add-on:         OrgC11
Add-on args:    /shiftright


0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Nice, Chris, thanks. I had taken a more brute force approach using SendKeys, but have changed the code to use the appropriate command. Which, by the way, turns out to be one that's not on your list, /toolbar_vert2, based on the style that Joy is looking for.
Org-chart-with-station-shapes-v0.zip
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
One more thing, Joy -- currently, the new code only arranges the position shapes under the managers. If you want the first-level shapes under the executives to be arranged in a particular way, just let me know.

Scott
0
 
radiantjoyAuthor Commented:
Thank you, Scott! This looks great but I do have a couple of questions:

1. Some of the shapes below the Executive appear as shaded circles - you had been kind enough to change that in v4 of the macros, but it's appearing again. I did a side-by-side comparison of v4 and v5 and the only difference i saw was that this code was commented out (shpTo.CellsU("LinePattern").FormulaForceU = shpFrom.CellsU("LinePattern").FormulaU) in the modCopyOrgChartProperties module...I activated it again but the shaded shapes still appear. What am I missing?

2. The formatting applies beautifully to some managers and employee shapes but not to others (Page 2 1.4 and below are tweaked). What did I do wrong?

I'm attaching the before vsd (a drawing based on the converted Excel data), the after vsd and the replace macros.

Thank you!!!! test-prototype-before.vsd Test-prototype-after.vsd
Replace-Org-Chart-Shapes-v05.vsd
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Re #1: My fault -- I forgot to mention that you need to replace the stencil I previously sent (org chart station shapes.vss) with the one in the zip file above. The new layout function required that I alter the manager shape in the stencil, hence the new version.

#2: I have no idea! Similarly, I have no idea why the connector for 7.9 on page-1 follows a different path than every other line from the executive shape. As best I can tell, neither of these things is the result of anything you or my code is doing -- they're just quirks of the org chart add-in (of which there are many).

And speaking of quirks... I can't recall whether we've discussed this before, but one of the *long standing* oddities of the org chart add-in is that you have no control over the left-to-right sequence in which it places subordinates. That's why on Page-1 you see 7.11, 7.7, 7.14, 7.17... There is neither rhyme nor reason and there's nothing you can do. We Visio MVPs have complained loudly and often; Chris, aka Visio_Guy, who responded above has been an MVP a lot longer than I and can vouch for the number of conversations about this peculiar "feature."
0
 
radiantjoyAuthor Commented:
Hi Scott!
I replaced the stencil shapes but now I freeze when I run the macros. Oh, I am so sorry but can you tell me what I'm doing wrong?

[As a complete aside, when I import shapes from the Excel file with macros, only the first level (executive appears) now appears...I didn't have any issues before running the change macros - I know this is a shot in the dark and I will do more troubleshooting if the issue goes away with the below, but do you think the two might be related? In actuality, my .vsd may go as far as 5 levels deep.]

Thank you!!

test-prototype-before.vsd Org-chart-station-shapes.vss Replace-Org-Chart-Shapes-v05.vsd
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Joy,

Are you sure Visio actually hangs on your PC? How long did you wait before deciding it was hung?

For example, on my PC it takes one minute 20 seconds for the shape replacement to complete using your sample org chart. There is no visible sign of activity during that period, but it does finally finish.  Please try again and let me know what happens.

Regarding the import issue, I have to assume that's a separate problem because you don't run the substitution macro until after the org chart wizard has finished doing the initial import. It sounds like there might be a problem with structure or format of the data in the Excel workbook. Perhaps there is an issue with the functions/macros we wrote months ago to prepare your data? Let's get the shape substitution/layout working properly then I'll be happy to take a look at the import problem.

Scott

0
 
radiantjoyAuthor Commented:
Forgive me, when I tried this earlier in the week, it hung for 15 minutes (I started it and then went about other tasks) before I gave up.

I tried again today and it worked within a couple of minutes. Apologize for the false alarm.

Thank you for letting me know that it's a Visio quirk about the non-sequential ordering. I'll move the shapes around manually to address that.

To minimize the manual tweaking, may I impose on you one last time to see if there is a way that I can get all of the lines to appear straight? Some are still askew and I'm not sure how to address it.

THANK YOU!
test-prototype-after.vsd askew objects
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
I will look into the placement of the Manager shapes under the Executive. It seems to be one near the executive on each page that isn't properly aligned...
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Well, this was another weird wrinkle but it's now working. The weird part is that I couldn't set the horizontal spacing within the same macro that does everything else. However, the exact same line of code works if you run it in a separate macro. Consequently...

After you run the replace shapes macro, which now includes a progress indicator, by the way, run the SetHorizontalSpacing macro.

Let me know what you think.

One more thing -- during all of my testing in the last few days, the macro did hang Visio a couple of times. No idea what that's about but it did happen to me also.
Replace-Org-Chart-Shapes-v06.vsd
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
The specific value I chose for horizontal spacing was totally arbitrary -- 1 1/8 inches between shapes. If you want a larger or smaller interval, let me know.
0
 
radiantjoyAuthor Commented:
Amazing! Thank you so much, Scott! Perfect!

Thank you for sharing that the "hanging" happened to you as well. Often, as users/un-experts, we feel that it's us who cause any funkiness. You are so gracious to be so honest.

I wish I could award you more than the maximum amount of points but I hope my immense gratitude will supplements the points awarded.

Thank you, again, for everything!

Joy
0
 
radiantjoyAuthor Commented:
Scott was immensely patient and extremely generous with his time, knowledge, and good-will.
His patience is never-ending and helped me with a solution that exceeded my expectations.
I am most grateful.
0
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Joy,

You are most welcome. You deserve a special award for your patience during the months that it's taken me to work on this sporadically. I'm glad the result is something you can use. Re your desire to award more than the allotted points -- I appreciate the sentiment. You can, of course, tell all of your friends to buy my Visio book! :-)>

BTW, I vaguely remember that the station shapes in your very earliest prototype showed colored rings for the three position types. Let me know if you want to add color to the masters for the three position shapes. It's easy to do and I can send you the steps.

Also, one other enhancement that occurred to me as I was finishing up over the weekend: would you like the size of each Visio page to expand automatically to accommodate all of the shapes?

Regards,
Scott
 
0
 
radiantjoyAuthor Commented:
Funny that you mentioned your book - I already bought the Kindle version!! And, believe me, I have been speaking about you to all of my colleagues...they are most impressed that someone as knowledgeable as you took the time to help little 'ol me!

I like the two-tone end result we came up with...the indentation is perfect to differentiate the different levels.

By having Visio automatically accommodate all of the shapes, do you mean, changing from Letter to Legal to supersize BIG page size? Or, squish stuff so that it fits in a letter size page.

If the latter is that possible? if so, I'll open a new request! It would be great to automate...I was thinking about having to manually smoosh the larger pages somehow.

Thank you!


0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 8
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now