Displaying the Windows Directory as a Visio Organization Chart

AID: 2802
  • Status: Published

10300 points

  • Byscott
  • TypeGeneral
  • Posted on2010-04-04 at 18:37:07
Awards
  • Community Pick
  • Experts Exchange Approved
The Question
Several times in recent years, someone has posted a question at EE asking whether they could display the Windows directory structure – folders and subfolders – using Visio. When one person specifically asked about displaying directory info in an organization chart format, experts Scott and oldviking decided to give it a try, with the goal of producing something like this:
Final-result-for-Microsoft-Offic.jpg
  • 182 KB
  • Final result for MS Office directory
Final result for MS Office directory

When you think about it, displaying a directory as an org chart is a very logical idea. After all, the Windows directory on a hard drive is a hierarchical structure and the Organization Chart Wizard that comes with Visio was designed to display hierarchical information.

The Two-Part Solution
To get started, Scott wrote an Excel macro that collected names and paths of the subdirectories on a Windows hard drive or network share and wrote the results to the worksheet. The collected data also included the attributes of each directory (Read-only, Hidden, System, Archive and Compressed; see reference 1 below for code that obtains directory attributes).

After some fine tuning by oldviking, the directory listing in Excel for "C:\Program Files\Microsoft Office\" looked like this:
Excel-screen-shot.jpg
  • 198 KB
  • Directory data in Excel
Directory data in Excel

With an automated way to create the spreadsheet in hand, the authors intended to manually invoke the Visio Org Chart Wizard to read the data and create the directory display.

The Integrated Solution
However, at this point Scott started wondering whether the Org Chart Wizard could be automated. A brief search turned up reference 2 below so he moved the Excel code into a Visio VBA project and added new code to create the Org Chart. To use the resulting code:
  • Open the Visio file attached to this article
  • Double-click on the org chart graphic in the center of the page
Org-chart-graphic-in-macro-docum.jpg
  • 39 KB
  • Org chart graphic in macro document
Org chart graphic in macro document
  • Navigate to and select a starting directory
Directory-browse-dialog.jpg
  • 44 KB
  • Dialog for selecting starting directory
Dialog for selecting starting directory
  • Click OK

 NOTE: While the Org Chart Wizard is working you will see a progress indicator like this one:
Progress-indicator.jpg
  • 17 KB
  • Progress indicator
Progress indicator

A couple of seconds after the progress indicator disappears, Visio will open a new document and display your org chart. The finished result for "C:\Program Files\Microsoft Office\: is shown here:

Final-result-for-Microsoft-Offic.jpg
  • 182 KB
  • Final result for MS Office directory
Final result for MS Office directory

A couple of notes about the appearance and operation of the Windows directory org chart program:
  • The org chart for your directory structure will be split across multiple pages automatically, if required.
  • In many cases, subdirectories will be shown on the same page as the parent directory.
  • If there are many subdirectories under a given directory, the Org Chart Wizard will put them on a new page and will create hyperlinks between pages, in both directions. (If a hyperlink symbol appears beneath the cursor when you hover over any directory rectangle, it is hyperlinked to another page.)
  • Each rectangle on the directory org chart contains the name of the directory and its attributes.
  • If a directory has no special attributes, you will see five dashes, e.g.
Directory-box-with-no-attributes.jpg
  • 3 KB
  • Directory with no attributes
Directory with no attributes
  • If a directory has one or more attributes set, the corresponding dash will be replaced by a one of the letters RHASC, corresponding to Read-only, Hidden, System, Archive and Compressed, e.g.,
Directory-box-with-attributes.jpg
  • 6 KB
  • Directory with attributes
Directory with attributes
  • Directories that do not contain subdirectories are shown in a rectangle with a single line border like "Code Samples Library" above.
  • Directories that contain subdirectories are shown in a rectangle with a double line border like "Favorites" and "Local Settings" above.
  • If a page contains a large number of directory boxes, the Org Chart Wizard may place some of the boxes off the drawing page but they will still be visible. You can manually resize the drawing page, if desired.
  • If you choose a directory with many subdirectories, the Org Chart Wizard can take a while to finish, sometimes continuing to work even after the progress indicator disappears. If this happens on your system, the org chart can look a bit strange – see the graphic below – until the wizard does its final cleanup. But don’t despair – another two to ten seconds and you should see the final result.
Near-final-result-for-Microsoft-.jpg
  • 202 KB
  • Near-final result
Near-final result

System Requirements
This solution requires both Microsoft Visio and Microsoft Excel to be installed. The Visio macro has been tested with Visio 2003, Visio 2007 and Visio 2010 Release Candidate.

Summary
Though it has a few deficiencies, the Visio Org Chart Wizard does a pretty good job of providing a visual representation of Windows directories. Please provide feedback below to let us know whether you like this idea and whether you have suggestions for further refinements.

Acknowledgments
The EE Article system doesn’t allow for more than one author to get credit for an article. Despite the fact that this article was published under my name, oldviking was a vital part of the concept, code creation, testing, and article writing.

References
1) VBA code for obtaining directory attribute settings:
     http://msdn.microsoft.com/en-us/library/5tx15443(VS.85).aspx

2) Visio Organization Chart Wizard parameters
     http://office.microsoft.com/en-us/visio/HA010774641033.aspx
(Scroll down to “Create a chart from data using the command line or Run method”)

3)VBA code to present the user with a directory browse dialog:
     http://users.skynet.be/am044448/Programmeren/
(Click “VBA General” then “Browsing for a Folder”)


Asked On
2010-04-04 at 18:37:07ID2802
Tags

Windows directory

,

directory

,

subdirectory

,

directory listing

,

org chart

,

organization chart

Topic

Microsoft Visio

Views
4099

Comments

Expert Comment

by: Lupo09 on 2010-09-05 at 04:00:02ID: 19104

Scott,

is there a way to tell the wizard where to begin a new page?

As I understand the wizard, it will put the next child objects on another page if there is not enough space on the current one.

I would like to add the information in the Excel-File where I want to split the Orga Chart.

In my case, I want to view sub-departments on new pages although there might be space on the parent department page.

Is there a way to do that?

Thanks,

Kai

Author Comment

by: scott on 2010-09-05 at 06:31:14ID: 19105

Take a look at reference 2 at the bottom of the article; if you scroll down to the list of command line parameters, you'll find this one:
/PAGES=<top employee> <num levels> PAGENAME=<pagename>, <top employee> <num levels> PAGENAME=<pagename>...

I haven't used it but it sounds like what you're looking for.

Scott

Expert Comment

by: Lupo09 on 2010-09-05 at 09:23:44ID: 19106

Thank you, that's the way it works!

At that occasion I have alook at all the other parameters, maybe I can find more interesting stuff there...

Thanks!

Kai

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top MS Visio Experts

  1. scott

    77,220

    Master

    50 points yesterday

    Profile
    Rank: Genius
  2. aikimark

    5,600

    0 points yesterday

    Profile
    Rank: Genius
  3. boag2000

    4,500

    1,500 points yesterday

    Profile
    Rank: Genius
  4. Netty

    3,600

    0 points yesterday

    Profile
    Rank: Guru
  5. craisin

    2,800

    0 points yesterday

    Profile
    Rank: Guru
  6. pony10us

    2,800

    0 points yesterday

    Profile
    Rank: Wizard
  7. TempDBA

    2,800

    0 points yesterday

    Profile
    Rank: Sage
  8. Visio_Guy

    2,450

    0 points yesterday

    Profile
  9. dp_expert

    2,100

    0 points yesterday

    Profile
    Rank: Wizard
  10. Scottyworld

    2,000

    0 points yesterday

    Profile
    Rank: Guru
  11. FarzadA

    2,000

    0 points yesterday

    Profile
    Rank: Guru
  12. armchair_scouse

    2,000

    0 points yesterday

    Profile
    Rank: Master
  13. quihong

    2,000

    0 points yesterday

    Profile
    Rank: Sage
  14. jackieman

    2,000

    0 points yesterday

    Profile
    Rank: Genius
  15. Russell_Venable

    2,000

    0 points yesterday

    Profile
    Rank: Wizard
  16. vs00saini

    2,000

    0 points yesterday

    Profile
    Rank: Wizard
  17. DaveBaldwin

    1,600

    0 points yesterday

    Profile
    Rank: Genius
  18. giltjr

    1,600

    0 points yesterday

    Profile
    Rank: Genius
  19. Racimo

    1,500

    0 points yesterday

    Profile
    Rank: Sage
  20. matthewspatrick

    1,500

    0 points yesterday

    Profile
    Rank: Savant
  21. Run5k

    1,500

    0 points yesterday

    Profile
    Rank: Genius
  22. TRTurner

    1,500

    0 points yesterday

    Profile
    Rank: Master
  23. John-Charles-Herzberg

    1,500

    0 points yesterday

    Profile
    Rank: Guru
  24. buzzyclonecattleman

    1,200

    0 points yesterday

    Profile
  25. onlyaymie

    1,000

    0 points yesterday

    Profile
    Rank: Master

Hall Of Fame