August, 2006

Visio Insights
The official blog of the Microsoft Visio product team

August, 2006

  • Visio Insights

    Adding Your Own Shapes to Visio


    Visio users and developers often wonder how to distribute their newly created Visio shapes to their colleagues, friends and family (all depends on your friends and family I guess J). Visio offers two mechanisms to publish content, each suited to different situations.  This blog entry covers both.  But first, an introduction for those new to content creation.

    What’s content?

    In the Visio world, content refers to shapes, stencils and templates; if you’re familiar with these concepts, please skip to the next section, if not please read on.

    ·         Master shapes are the basic unit of content; they are Visio entities that you can assemble on a drawing page that graphically represent a real-world object or concept. Visio provides a rich set of pre-made master shapes and also enables the creation of custom shapes. To get started authoring shapes, read through this Visio Insights blog posting as well as this set of documents from Microsoft Office Online.


    ·         Stencils are collections of related master shapes that are presented together in the UI. Again Visio provides a large set of pre-made stencils and lets you create your own stencils containing custom made and/or pre-built Visio shapes by following the steps outlined here. Stencils files have a “.VSS” or “.VSX” extension.


    ·        Templates are Visio files that set up the Visio workspace for a particular drawing type by opening appropriate stencils, opening anchored windows and setting page properties such as scale and grid. For example the Space Plan template that ships with Visio opens four stencils, changes paper size and scaling. Instructions on how to create templates may be found here. Template files have a “.VST” or “.VTX” extension.


    Publishing Content

    Publishing a piece of content to Visio adds entry points to the user interface side-by-side with content created by Microsoft. For a stencil this translates into a menu entry added to the File > Shapes fly-out menu while for a template this means an entry in Visio’s startup screen (as seen below) and in the File > New fly-out menu. In this blog entry we will focus on publishing templates to Visio; publishing stencils is quite similar.



    Method #1: Sharing Templates using Path Discovery

    The simplest way to publish a template to Visio is to use the Path Discovery method described below:


    1.       Copy your template and supporting stencils to a known location on a drive.

    2.       Add the location defined in step 1 to Visio’s “Template Paths”; this tells Visio where to find extra content to populate its startup screen. This can be done manually by following the steps here or may be automated using code that sets the TemplatePaths property on the Visio Application object.

    3.       Restart Visio – your template should appear in the (Other) category.

    The advantages of this approach are:

    ·         It is simple.

    ·         It is supported across most versions of Visio.

    It however has a few drawbacks:

    ·         Your users may be subjected to potentially long and error prone manual work.

    ·         Your templates will always end up in the (Other) content category in the startup screen.

    ·         You don’t have any way of repairing content on a user’s machine if it gets damaged.

    ·         You cannot control which language of Visio will load your stencils and templates. 

    ·         This approach does not scale well. The Path Discovery publishing method does just that: every time you boot Visio it searches a user’s hard drive for content files – an expensive operation.


    Sharing templates through Path Discovery is good for small scale content deployments as well as deployments to older versions of Visio.

    Method #2: Sharing using the PublishComponent System

    The PublishComponent system introduced in Visio 2003 lets developers use Windows Installer technology for template distribution to register their content with Visio in a richer and more robust way. The main advantages of this method are quite interesting:

    ·         The Windows Installer setup wizard is familiar to users and easy to use.

    ·         You may choose where your content appears in the File > Shapes or startup screen hierarchies.

    ·         You benefit from Windows Installer repair, install-on-demand and add/remove features.

    ·         You may choose what language versions of Visio to publish your content to.

    ·         The approach scales well: Visio only rebuilds its content cache, a moderately expensive operation, when new content is published.

    ·         The approach is tried and tested since the product publishes its own content this way since the 2003 release.  

    That said, using the Publish Component system is:

    ·         A little more complicated than the Path Discovery method.

    ·         Will only work for Visio 2003 and or later.

    To use this method you’ll need Visual Studio .NET or later, the Visio 2003 SDK (or the Visio 2007 Beta SDK) and the following steps:

    1. Create a setup project in Visual Studio.
    2. Select the "Application folder" and change its default location property to your target install location. Add your template and their supporting stencils to this location by dragging files into the folders. Your project should look something like the figure below at this point.


    1. Build the project. This will produce an MSI file - a multi-table installation database that is used by windows to coordinate setup.

    If you installed the package as it is; Visio would not discover the files the MSI installed. To notify Visio on the whereabouts of these files, the next thing to do is populate the PublishComponent table of the MSI produced above with registration data. Once installed, this extra information will force Visio to rebuild its content cache and incorporate and display the new templates and stencils.

    The extra information you need to add may be found here. Be warned however, it is not for the faint of heart to enter this data manually. For those of us who would rather not spend their Saturday night writing MSI tables entries you can follow the steps below using the PublishComponent tool shipped in SDK to populate the appropriate MSI table easily:

    1. Install the Visio SDK & start the publish component tool (this tool may be found in the Start menu entry for the Visio SDK).
    2. On the File menu, select New. It will prompt you for an MSI; navigate to the one that you've just built.
    3. This will present the Visio Files that are in MSI. You must now, for each entry:
      1. Set the LCID of the language for which you want the templates to be accessible in. Do the same for the supporting stencils.
      2. Set the position in the Visio startup screen hierarchy you want the template to live in. This is defined by separating different levels of the hierarchy by “\” symbols for example: “MyTemplateCategory\MyTemplateSubCategory\MyTemplateName”. Do the same with the supporting stencils, setting their location in the File > Shapes fly-out.

    To make the changes described above double click on each entry to bring up the “Template Information” dialog seen below, or its counterpart the “Stencil Information” dialog.


    1. Press the "!" button in the tools toolbar; this will make modifications to the MSI's Publish Component table.
    2. Voilà… you’re done.

    The MSI can now be distributed; Windows Installer and Visio will do the rest. Although we haven’t discussed it here, the same techniques can be used to publish add-ins and help files. For the curious, use ORCA and the guidance in the KB article above to understand what modifications the tool made to the MSI.

    As a final note, you’ll see that the template you just published shows up in the startup screen, however the template preview is blank; I’ll leave it up to crafty souls out there to figure out how to get template preview’s this working… OR you could stay tuned to the Visio Insights blog for more info =).


  • Visio Insights

    Shapes in the Cloud


    If you can’t find the shape you’re looking for in Visio, it may be available online. There are several sets of shapes available only on the Web. In this post, we’ll talk about these shapes and how to find them.


    The online shapes can be accessed using the Search for Shapes feature in Visio 2003 or Find Shape in Visio 2002. You’ll need to have an Internet connection, and you’ll need to check the Visio Web Shapes option on the Shape Search tab in Tools > Options.



    Geographic Map Shapes

    There are Visio shapes representing most of the country/regions of the world (some are omitted because their boundaries are in dispute). These shapes are available to users of English, French, German, and Japanese language versions of Visio 2002 and 2003. In addition, the individual U.S. states are available to users of U.S. English Visio.

    The best way to get the whole set of world map shapes is to enter “World Maps” (including quotes) in the Search for Shapes field at the top of the Shapes window. If you’re using U.S. English Visio, enter “United States Maps” (including quotes) to get the shapes for all the states.



    Once you’ve added these shapes to your drawing by dragging and dropping them from the search results window, you can format them like any other Visio shapes and you can right-click on them to arrange them in their correct geographic locations using the “Arrange To Page” and “Arrange To Shape” commands on the right-mouse menu. See the articles on the Microsoft Office Online site for more details on working with these shapes. There are separate instructions for Visio 2002 and Visio 2003.

    Business Process Modeling Notation Shapes

    There is a set of Business Process Modeling Notation (BPMN) shapes available online to users of English Visio 2003. Enter “BPMN” in the Search for Shapes field to see the full set of shapes available.


    Note: The BPMN shapes were based on a pre-1.0 version of the BPMN specification, and there have been a number of changes to the specification since then so they aren’t completely up to date. However, several third-parties have created BPMN templates for Visio.

    Six Sigma Shapes

    For the Six Sigma practitioners, there are three sets of shapes available online for English Visio 2003:

    • Six Sigma House of Quality: Lets you assemble a House of Quality matrix diagram. Enter “House of Quality” in the Search for Shapes field to get these shapes.
    • Six Sigma graphs: Shapes for graphs commonly used in Six Sigma, such as curves, histograms, and box plots. Search for “Six Sigma graphs”.
    • Six Sigma formulas: Includes some of the mathematical formulas used in the Six Sigma methodology. Search for “Six Sigma formulas”.


    Other Sources for Shapes

    There are other sources for third-party shapes in a wide variety of industries. These include the list maintained by Visio MVPs (Microsoft “Most Valuable Professionals”) as well as the Visio Cafe site.



  • Visio Insights

    Sizing Shapes to Text


    In a previous post, we saw how to use the ShapeSheet to resize text based on a shape’s size.  A related question we sometimes hear is how to make a shape automatically resize to contain its text.  Visio includes some shapes that resize based on their text.  Go to File > Shapes > Visio Extras > Callouts and try out the shapes near the top of the stencil.  Let’s see how to build this into a shape.

    People often want to fit more text into flowchart shapes.  We can make the text smaller for shapes that cannot fit all the text, but this sometimes makes diagrams difficult to read.  In other cases, it is OK to resize shapes based on the amount of text they contain.  Let’s say we have this piece of a process flowchart.

    The size of the Document shapes is unimportant, so we can create a formula to control the height of the shape.  Select the shape and open its ShapeSheet by choosing Window > Show ShapeSheet.  Visio opens a new window that shows the properties that drive the shape’s behavior.

    The shape is taller, but the text still doesn’t fit right.  In this case, the Document shape is designed to keep the bottom of the text block above the rounded part of the shape, preventing it from being obscured.  We can just add a little buffer to the height of the shape.

    But if the shape is resized manually by adjusting the green handles shown when the shape is selected, the formula will be lost.  We want the shape to always be at least as tall as the text it holds.  We can use the SETATREFEXPR formula to “pick up” the height that is set by manipulating the green handles.  Then, use MAX to compare that to the height from the formula above and use the larger of the two.

    The shape still looks the same, but now if we resize the height manually, the formula is not lost.  And if we try to make the shape smaller, Visio only allows it to shrink small enough to contain all the text.

    If this formula were applied to all Document shapes, each one would be a different size based on the amount of text it contains.  We can add a condition that keeps the shape at least as large as it was originally.  With this, shapes may resize larger but never smaller.  Another MAX condition ensures that Visio chooses the largest of the original size (0.75 in.), the calculated size and the manually set size.

    The SETATREF trio of functions can be a little tricky to learn, but contain a lot of power for building formulas that interact well with manual changes made through Visio’s user interface.  More on these in a future post.


  • Visio Insights

    Sizing Text with Shapes


    We occasionally get questions about how to size shapes to text or text to shapes.  While most Visio shapes do not behave like this by default, both cases are made possible through ShapeSheet formulas.  In fact, Visio includes some shapes that resize based on their text.  Go to File > Shapes > Visio Extras > Callouts and try out the shapes near the top of the stencil.  Let’s look at how to make a shape resize its text based on its width or height.


    First, select a shape on the page.  We’ll start with a simple Process shape from the Basic Flowchart stencil.  Open its ShapeSheet by choosing Window > Show ShapeSheet.  Visio opens a new window that shows the properties that drive the shape’s behavior.



    In the ShapeSheet window, scroll down to the Character section.  The Size cell is set to “8 pt” which matches the text size shown in Visio’s Formatting toolbar.



    Let’s say 12 pt is the baseline size we want for our text at the shape’s current size of 1 inch by 0.75 inch.  We want the text to size with the width of the shape.  A simple formula in the Size cell achieves this.



    This scales a base size of 12 pt by the width of the shape.  (Width is the name of a cell in the Shape Transform section, at the top of the ShapeSheet.)  Our shape’s text is now 12 pt.  Note that if we do not specify a unit, Visio assumes a default that is appropriate for the locale.  Multiplying by 1 pt scales the Width to points.



    If the shape is stretched to twice its original width, the text becomes 24 pt.



    What if we want the text to also size with height?  What if we only want the font size to change in increments of 2 points?  We just need to change the formula.  This formula scales the text size based on the larger of the two dimensions in 2 pt steps.



    We don’t want to lose this formula when manually setting a font size using the Formatting toolbar.  Wrapping the formula in a GUARD() will prevent it from being changed, even from the toolbar.  The SETATREF functions offer ways to combine formulas with changes made through the user interface, but are a bit more complex to use.


    All of the ShapeSheet cells and formulas are described in the Visio SDK documentation – downloadable or online at MSDN.  In a future post, we’ll look at the reverse of this behavior, how to resize shapes based on the text they contain.



  • Visio Insights

    Shortcuts to Edit in Visio


    There is a lot of cool functionality in Visio, and some may be more accessible than you think. Especially for those of you who are keyboard aficionados, keyboard shortcuts in Visio could save you time better spent in polishing your diagram.


    Here are a few of our favorite shortcuts:


    1) Getting around your diagram

    • Zoom in (Ctrl + Shift + Left-click  or Ctrl + Mouse wheel up)
    • Zoom out (Ctrl + Shift + Right-click or Ctrl + Mouse wheel down)
    • Zoom to selection (Ctrl + Shift + Left mouse drag)
    • Zoom to whole page (Ctrl + W)
    • Pan (Ctrl + Shift + Right mouse drag), Pan right  (Shift + Mouse wheel up), Pan left (Shift + Mouse wheel down)

    2) Select, add text, and connect your shapes, as easy as 1-2-3!

    • Pointer tool (Ctrl + 1)
    • Text tool (Ctrl + 2)
    • Connector tool (Ctrl +3)  (Note that if the Connector tool is selected and a shape is selected, dropping a new shape adds it connected to the first one)

    3) Layout and layering of shapes

    • Bring to front (Ctrl + Shift + F)
    • Send to back (Ctrl + Shift + B)
    • Group (Ctrl + Shift + G)
    • Ungroup (Ctrl +Shift + U)
    • Align Shapes (F8)
    • Align shape to original X or Y axis when moving shape (Shift + Mouse drag)
    • Nudge shape (Shift + ←,↑,→,↓)

    4) Duplicating selected shape

    • Copy (Ctrl + C), then paste (Ctrl + V), or
    • Ctrl + mouse drag selected shape to duplicate  (Tip: you can also hold Shift to align the duplicated shape to the original X or Y axis)       

    5) Switch page

    • Previous Page (Ctrl +PageUp)
    • Next Page (Ctrl + PageDown)

    6) Full screen (F5)

    7) Open Visual Basic Editor (Alt + F11)


    As Mai-lan’s blog mentioned before, Dan Brown has a keyboard shortcut mouse pad available here.


    Also, for a complete list of Visio shortcuts see here.

  • Visio Insights

    Running with Characters


    When working with shape text through automation, the Text property of a Shape is generally sufficient to get and set the text.  However, this simple property ignores the fact that Visio text may have rich formatting applied or that the text is composed of text fields.  If you need a more industrial-strength way to retrieve and modify shape text, use the Characters object for the Shape.


    Characters is a kind of do-it-all object for manipulating text.  It is capable of breaking text down into individual characters or sets of characters.  The Characters object can describe text in much the same way that the Visio Shapesheet stores shape text.  Consider the following shape with text:



    The shape text consists of a single line with a variety of formats applied to the characters.  Visio has to keep track of not just the characters but their formatting as well.  It does this using text runs.  A text run is a set of characters that have something in common.  Typically a text run is a set of characters with identical formatting.  That is how Visio represents text in the Shapesheet.



    Our sample text is described by six text runs.  The number in the first column defines how many characters are in the run.  Thus “Hello “ is described by the first line.  “World” is in the second line.  The space after “World” is next.  Then “Sample “, then “Text”.  Finally Visio (starting in 2003) terminates text with a non-visible character.  Note that this final character is not reported when using the Shape.Text property, but it is reported using Shape.Characters.Text.  Our sample text varies mostly by the Style property, which defines whether there is any bold, italics or underlining.  Also the Color property varies for one text run. 


    There is also a notion of a paragraph run, which is the collection of all characters with the same paragraph formatting properties.  Note that, like a text run, a paragraph run can span across carriage returns because it describes the formatting not the structure.  The number in the first column defines the number of characters in the run.  In our example all the characters in the shape text use the same paragraph formatting properties, so Visio put a zero in the column.  This would similarly apply to the Characters section if there were no variation in character formatting.


    The Visio SDK has sample code demonstrating how to set up custom formatting on shape text, but there isn’t an example of reading the text back.  Let’s take a look at a function that can analyze Visio shape text and return the specific text runs that describe the formatting boundaries.


    using System;

    using System.Collections.Generic;

    using System.Text;

    using IVisio = Microsoft.Office.Interop.Visio;


    public class TextUtilities


        public static List<string> getTextRunList(IVisio.Shape vsoShape)


            List<string> textRunList = new List<string>();


            // Get the Characters object representing the shape text

            IVisio.Characters vsoChars = vsoShape.Characters;

            int numChars = vsoChars.CharCount;

            int runBegin = 0, runEnd = 1;


            // Find the beginning point and end point of every text run in the shape

            for (int c = 0; c < numChars; c = runEnd)


                // Set the begin and end of the Characters object to the current position

                vsoChars.Begin = c;

                vsoChars.End = c + 1;


                // Get the beginning and end of this character run

                runBegin = vsoChars.get_RunBegin((short)IVisio.VisRunTypes.visCharPropRow);

                runEnd = vsoChars.get_RunEnd((short)IVisio.VisRunTypes.visCharPropRow);


                // Set the begin and end of the Characters object to this run

                vsoChars.Begin = runBegin;

                vsoChars.End = runEnd;


                // Record the text in this run



                // As the for loop proceeds, c is set to the end of the current run



            return textRunList;




    This C# code uses a .NET 2.0 Generic string list to store each text run found.  The Characters object is retrieved from the text, and the total character count is stored.  Then the procedure iterates through the characters from beginning to end.  However, the For Loop is unusual because it does not increment on a character by character basis.  Let’s examine the For Loop more closely.


    The purpose of the For Loop is to find text runs and add them to the string list.  First a substring within Characters is defined by setting the Begin and End properties of Characters.  This substring is initially just the next two characters in the text.  Then the boundary of the text run containing those characters is established by calling RunBegin and RunEnd.  These methods search for the first and last characters of the text run containing the substring.  A new substring is defined by updating the Begin and End properties to match RunBegin and RunEnd.  This substring is added to the text run list.  Since the procedure has located the end of the current run, the For Loop is incremented to start at this position when looking for the next text run.


    Once you have a list of the text run strings, you can match them with the property information retrieved from the Characters section of the Shapesheet.  This gives a more complete description of the text contents.  There are other uses for RunBegin and RunEnd beyond character formatting.  By passing other flags to the methods, you can get the paragraph runs instead or even individual words or text fields.


  • Visio Insights

    No More Template Help


    A common newsgroup question is how to prevent the Template Help task pane from appearing every time a document is opened.  Not only do we see lots of newsgroup posts about this, it turns out that one of the more common pieces of feedback we receive through Rate this Template is “Let me disable this task pane”.



    Here are the steps to disable automatically showing the task pane:


    1)      Go to Tools > Options in the menu

    2)      Click on the General tab and choose Service Options at the bottom

    3)      Select the Online Content category and uncheck “Show Template Help automatically…”



    The task pane is intended to help people learn more about various diagram types.  Unfortunately the design tends to focus on the initial usage experience (having the template help in your face) at the expense of ongoing productivity (having lots of drawing space).  Perhaps the biggest problem is that there is no place on the task pane itself to disable the automatic behavior.


    The good news is that there is no Template Help task pane in Visio 2007.  There is a link to template help at the bottom of the Getting Started screen.  It is grouped with all the other content available from Office Online.  Hopefully this is a better location both for those that want to find template help and those that do not want to be bothered by template help.




  • Visio Insights

    Running with Characters, part 2


    In the previous post we looked at the Characters object in Visio and used it to find the runs of formatted text in a shape.  In this post we’ll complete the scenario by reading the formatting information from the Shapesheet to match it up with the text runs.  Here is our sample shape text with mixed formatting.



    We walked through the function getTextRunList to generate a list of the substrings within shape text.  Each string represents a text run - a set of characters that have the same formatting applied.  So what are the formatting properties for each text run?  This information is stored in the Character section of the Shapesheet.



    Each row in the Character section corresponds to a text run.  We can read the Shapesheet cells in these rows and associate the properties with the substrings in the text run list.  Before looking at the code to do this, we need to create a simple structure to store the text and formatting information.

        struct VisioFormattedTextRun
            public string text;
            public int font;
            public double size;
            public string color;
            public bool bold, italic, underline;


    This structure holds the text for the text run as well as six properties for the formatting.  There are many more properties that describe Visio text, but these are the most common.  Now let’s look at a function to extract the formatted text from a shape and generate a set of VisioFormattedTextRun objects.  Note that you will need the getTextRunList procedure from the previous post.


    using System;

    using System.Collections.Generic;

    using System.Text;

    using IVisio = Microsoft.Office.Interop.Visio;


    public class TextUtilities


        public static List<VisioFormattedTextRun> getFormattedShapeText(IVisio.Shape vsoShape)


            List<VisioFormattedTextRun> formattedShapeText = new List<VisioFormattedTextRun>();


            short charSection = (short)IVisio.VisSectionIndices.visSectionCharacter;


            if (vsoShape.get_CellsU("HideText").ResultIU == 0)


                // Break up the shape's text into a set of text runs

                List<string> textRunList = getTextRunList(vsoShape);


                // Iterate through the rows in the Characters section to get the formatting matching each text run

                for (short iRow = 0; iRow < vsoShape.get_RowCount(charSection); iRow++)


                    VisioFormattedTextRun textRun = new VisioFormattedTextRun();


                    // Get the text for this row

                    textRun.text = textRunList[iRow];


                    // Make sure text is not empty before adding run

                    if (textRun.text.Length > 0)


                        // Get formatting for this text run

                        textRun.color = vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterColor).get_ResultStrU(IVisio.VisUnitCodes.visNoCast);


                        textRun.font = (int)vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterFont).ResultIU;


                        textRun.size = vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterSize).get_Result((short)IVisio.VisUnitCodes.visPoints);


                        int styleProp = (int)vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterStyle).ResultIU;


                        textRun.bold = ((styleProp & 1) == 1);

                        textRun.italic = ((styleProp & 2) == 2);

                        textRun.underline = ((styleProp & 4) == 4);


                        // Record text run






            return formattedShapeText;




    Let’s walk through this procedure.  First an empty list of VisioFormattedTextRun objects is created.  Then we check the HideText cell to find out if the shape text is actually being displayed.  This sample only retrieves the text if HideText is 0 (i.e. text is visible).  Next is the call to getTextRunList to create a list of text substrings with common formatting.


    The main part of the routine iterates through all the rows in the shape’s Character section.  A new VisioFormattedTextRun object is created.  The text property is set to the current substring in the text run list.  Then individual Shapesheet cells are read from the current row in the Character section.  The six formatting properties are assigned, and the VisioFormattedTextRun object is added to the overall formatted shape text list.


  • Visio Insights

    What's in Your Drawing?


    This post will be a little experiment to try out file attachments on the blog.

    When customers send files to us, we often want to get a general understanding about the drawing contents.  This is common in scenarios where customers are concerned about performance or file size.  Visio drawings may be carrying some excess baggage along.

    In addition to shapes on the page, a Visio document contains information about master shapes, styles, layers, fonts, colors, data and other items.  These collections of information are used to accurately present the shapes on the page.  However, they do not automatically get purged when shapes are deleted from the diagram.

    Take the simple example of a flowchart.  If you drag a Process shape onto the drawing page, Visio adds a copy of the Process master shape to the document and places an instance of this master shape on the page.  If you delete the Process shape from the page, the master shape remains.  Over time unused master shapes pile up.  Normally this is no big deal, but some shapes contain large bitmaps or other complex information that will quickly increase file size.

    Before you go out and delete every master shape from your document, keep in mind that master shapes are highly efficient when they are actually used in the drawing.  If you took a drawing with many copies of the same shapes and then deleted the master, you would find the resulting document much larger and slower.

    The attached DrawingAnalyzer.vsd document is a handy little tool written in VBA for counting the shapes in a drawing and determining whether there are unused master shapes.  Also the tool counts shapes on the page with no master shape, and it keeps track of the level of grouping among shapes.  More nested groups mean much slower performance.

    To use the tool, open the file in Visio along with any other document you want to analyze.  Make sure the document to be analyzed is in the active window.  Then go to Tools > Macro > DrawingAnalyzer > ThisDocument > GetDrawingStats.  Then open the VBA Editor (Alt+F11) and look in the Immediate Window (Ctrl+G) at the output.  Here's a sample result:

    Total Pages:             3
    Total Shapes:            495

    Top Level Shapes:        11
    Group Shapes:            92
    Max Nesting Depth:       3
    Total Masters:           13
    Unused Masters:          0
    Shapes w/o Masters:      36
    Total Patterns:          0
    Unused Patterns:         0
    Total Styles:            9

    A top level shape is a shape directly on the page.  All other shapes are found inside of groups.  In this example, there are only 11 shapes spread across the 3 pages in the drawing.  However, the total number of shapes is 495, meaning there are lots of shapes inside groups.  There are even groups inside groups inside groups as evidenced by the maximum nesting depth of 3.  This is not terribly efficient.  All 13 master shapes in the document are used in the drawing, so that is good.  36 shapes have no master.  If any of these shapes are similar, it would be more efficient to create a master shape for them.

    The DrawingAnalyzer.vsd file is saved in Visio 2000/2002 format.  Please post a comment if you have difficulties getting the file.  As we said, this is a test.



Page 1 of 1 (9 items)