Make Your Own Visio Data Graphic Icons Sets … automatically

In my last post, I showed how you can actually have up to six icons in a Visio Data Graphics Icon Set ( see ), and I finished by saying that I would now show how to create new icon sets from existing shapes … automatically. In fact, I will show you how to do it with existing SmartShapes or with images.

I was asked to make KPI icons from six weather images:


I wasn’t too keen with the graphics, so I explored the built-in Visio stencils, and found a similar series of shapes on the Symbols stencil:


They are okay, but I thought that I would also explore the images available from Clip Art:


So, now I have 3 alternative sets of cloud icons, and I wanted to see how they look as Data Graphic Icon Sets. It can be a bit tedious to manually make icons sets from code, so I thought that some VBA code would be best.

I am not going to go through all of the code in this article, because I have included it as a download at the end of this post.

The code is provided in a stencil, called bVisualIconSetMaker.vss, with no master shapes in it, so the easiest way to use it is to drop into your My Shapes folder, because you can then easily open it for any Visio document. There is just one public function, MakeIconSetFromShapes(), that expects you to have 1 to 6 shapes selected in the document that you want to add an icon set to. Read the previous article to see why 6 shapes can be selected, but also realise that the order that you select your 6 shapes dictates the order that they will appear in the icon set, with the sixth selected shape becoming the default icon. Of course, you don’t have to select six.

When you have selected your shapes in the order that you want them to appear (I selected the fourth one last in my example), then run the macro in the bVisualIconSetMaker stencil:


You will then be prompted to enter the desired name for your new icon set:


If the icon set name already exists, then you will be prompted to confirm that you want to delete the existing one first:


No that I had a new icon set, I could use it to change the icon set used in my test shapes:


Then I applied the new icon set to my strip of test shapes:


Faithfully reproduced, but too obviously an applied image for my taste…

I then repeated the task with the master shapes that I found in the Symbols stencil:


I then applied them to my test shapes:


Not bad … better than the rough weather icons I had been given.

Finally, I tried it with the arty images that I found using Clip Art:


When I applied them to my test shapes, I think I found my favourite:


Of course, the IconSet Maker can be applied to almost any shape. For example, I dragged and dropped 5 shapes from the Workflow Objects Shapes stencil.


I also added an extra Shape Data row, labelled Backup Method, to the Laptop Computer master shape, and made it a Fixed List type with the following Format formula:

=”;Floppy;USB Drive;CD/DVD;Tape;Remote”

This provides 6 options in the drop-down list because the first one is an empty string:


Then I applied the new Backup Icons icon set to some test shapes:



Then it is so simple to see which laptop is using which backup method:


Note : There is a Private Const iconSize statement at the top of the code file in the bVisualIconSetMaker.vss document. The normal values are 6 mm for Metric documents, and 0.25 in for US Unit documents. I changed it to 9 mm for the above Backup example.

This file contains all the code – bVisualIconSetMaker.vss :!2548&parid=3350D61BC93733A9!197&authkey=!AJaBnvdIOg8NVe4

This file contains the samples displayed in this article – MakeIconSets.vsd :!2549&parid=3350D61BC93733A9!197&authkey=!ALpMsVLV6RXeIQs

39 Responses to “Make Your Own Visio Data Graphic Icons Sets … automatically”

  1. johnvisiomvp Says:

    As usual, great job!

  2. bakry Says:

    Tried your tutorial on workflow steps in visio 2010 and got an error. Script got stuck on shape size. As if the shapes where too big to be converted in icons in an icon set

  3. Geir Says:


    Tried your code with your icons following your instructions in the article step by step

    shp.Cells(“Width”).FormulaForceU = “=GUARD(Height/” & hwRatio & “)”
    shp.Cells(“Height”).FormulaForceU = “=GUARD(Width*” & hwRatio & “)”

    always fails with a Run time error : “Error in formula”

    Using Visio 2010 Professional on win7

    • davidjpp Says:

      From what I can see, the only way that that formula can fail is if hwRatio is equal to zero.
      It needs to use FormulaForceU because you may have already applied the GUARD() function.
      I think the syntax is universal, but:
      What language is your OS, and Visio?

      • Geir Says:

        OS language : English
        Visio language : English
        Keyboard : Norwegian
        Localisation : Norwegian
        Standard setup for any norwegian PC using english language versions of OS and applications

  4. Mark Seymour Says:

    Hi David,

    Thanks for the macro it has been very useful. The one issue I have is with tidying up incorrect or unused Icon sets. If I select nothing and create the new set on an existing name it just creates a blank set. There are also sets I have forgotten the names of. Is there any way I can see all the sets and rename or delete them?

    Many thanks.
    Mark Seymour
    (Visio 2010 Premium)

  5. Olga Says:

    Hello David, I don’t know how to thank you. I have been racking my brain for days on end trying to get this done, and it worked like a charm with the macro you’ve written. You’re a total lifesaver!
    Many thanks and Regards,

  6. Nathan Says:

    Hi, The macro works great getting the new icon sets into the diagram – but when I attempt to publish it as a web diagram the diagram load fails. Is this not compatible with web diagrams?


  7. Potatobean Says:

    This is a great tool! thanks for posting. One request, can you tell us what needs to change in the code to have difference size height and width?

  8. Jeff Andres Says:

    Hi David,
    I second Mark’s comment above. Unfortunately the first time I ran the macro I did not know that I had to select the icons ahead of time. Now I have a blank set in the data graphics block. Any chance on letting us know how to remove it?
    Cheers, j

  9. Constantin Velásquez Says:

    Hi, I can’t download the file, is the link broken? Thanks.

  10. Yuri Weseman Says:

    I tried this macro but also got the Error in Formula message. Could I perhaps send you the file with icons so you can see for yourself?

  11. ChrisWuehrer Says:

    Hi David,
    thanks for the brilliant job! Great stuff.
    The first time i tried to run the macro I got that “error in formula” – but I think I figured it out why that error occurs.
    The decimal symbol on my machine (german layout) is a comma and that formula requires a dot as the decimal symbol. This means that “hwratio” is e.g. “1,25” and not “1.25” on my machine. Maybe that’s the reason for the other guys too.
    Once again the dearly beloved regional settings…

  12. aaron moorcroft Says:

    Hi David

    Im looking at creating a SCOM dashboard but I was wondering if I could actually use the icom sets as the main image so would need to be much bigger in size to be visable on the 32″ tv on the wall, the icon set for example traffic lights RED / Amber and Green would have a txt box below to explain the service again an example would be Exchange. dependant on if everything was ok the Traffic light icon would show as Green, amber or Red. Is this possible

  13. talulah1984 Says:

    My god it has took me three whole days at work to try and do this by myself then I stumble upon this article and hey presto!! My line manager will be pleased to see me moving on with my work – MANY thanks!

  14. A Table of Visio Data Graphic Icon Sets | bVisual - for people interested in Microsoft Visio Says:

    […] Make Your Own Visio Data Graphic Icons Sets … automatically […]

    • Caroline Rochon Says:

      You are AMNAZING!!!

      Can you help me on something else? Instead of using excel as the data source, I like to use MS Access. However, I would like to open the batase and update the specific record data by clicking on the visio form. Can you provide the code?

      • davidjpp Says:

        I would need a bit more information about what you are trying to do.
        Which version and edition of Visio?
        Which data linking option are you using (Link Shapes to Data or the older Database Wizard)?
        Are you wanting to update the MS Access data with the Visio shape data?

      • davidjpp Says:

        I eventually got around to provising a blog article …

      • Caroline Rochon Says:

        I can’t say it enough…. You are awesome!!!!!

  15. Lou Lowe Says:


    Thanks for sharing the macro and the associated instructions — great job!! I do have one question. When I used the new icon set that I create in a Data Graphic, it increased the side of my original graphic to approximately 3X their original size. Any way to control this? I would prefer that he size is locked down. BTW I am using Visio 2013 Professional.

    Thank You!


  16. Caroline Rochon Says:

    Visio 2013 Pro. Link shapes to data. I want ot update the data in MS Access by double clicking the shape while in Visio. I want the specifi Access databse record to po up in Visio so I can update it.

  17. Geoff Says:

    Hi, This is really awesome. I was even able to make my icons larger, which is great. However the border is larger and the icon no longer hugs the edge of my shape. I suspect that it’s something in the ‘Add a rectangle shape section but thought I’d ask first.


  18. Kim H Says:

    This is amazing!! I was able to create the icon set with the downloaded macro. One question, I’m a rookie at this. I want to make the icon set that I created available to my colleagues (as we are collaborating on these flows together). Can you point me to instructions on how to do that? using Visio 2016.

    • davidjpp Says:

      The macro creates a master shape in your Document Stencil ( More Shapes > Show Document Stencil). You can copy this to a new stencil, and then pass the stencil to your colleagues.
      Whenever they want to make the Icon Set available in a document they can open the stencil and copy the master to their local stencil (Or drag and drop the master onto a page, then delete it – not Undo). They only need to do this the once in any document.
      Visio provides a handy folder, called My Shapes, in your Documents folder. Any stencils in this folder, or a sub-folder, appear in the Visio UI under More Shapes > My Shapes.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Microsoft Office Development, and more...


Automate, Accelerate, Accurate


Life with Visio and other Microsoft Toys!

Title (Required)

Windows Server Essentials Tips & Tricks

Nilsandrey's Weblog

Just another weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Shapes, Stencils, Drawings Templates, Tutorials, Tips & Developer Info for Microsoft Visio

Hannes's Virtual Earth

Tips & Tricks around Mapping and Cloud Computing

Pluralsight blog

be smart, be clear, be visual ...

%d bloggers like this: