• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Visio / Visio 2010 / Make Your Own Visio Data Graphic Icons Sets … automatically

Published on April 19, 2012 by David Parker

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 http://davidjpp.wordpress.com/2012/04/11/how-to-have-six-icons-in-a-visio-data-graphic-icon-set/ ), 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:

image

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:

image

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

image

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:

image

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

image

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

image

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

image

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

image

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:

image

I then applied them to my test shapes:

image

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:

image

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

image

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.

image

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:

image

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

image

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

image

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 :

This file contains the samples displayed in this article – MakeIconSets.vsd

Related

Filed Under: Data Graphics, Shape Data, VBA, Visio 2010 Tagged With: Data Graphics, Icon Sets, Visio, Visio 2007

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. johnvisiomvp says

    April 25, 2012 at 12:04 pm

    As usual, great job!

    Reply
  2. bakry says

    June 22, 2012 at 5:50 pm

    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

    Reply
    • davidjpp says

      July 2, 2012 at 10:46 pm

      Just how big were your images, or were you using existing shapes?

      Reply
  3. Geir says

    October 27, 2012 at 7:09 am

    David

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

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

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

    Using Visio 2010 Professional on win7

    Reply
    • davidjpp says

      October 29, 2012 at 10:49 am

      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?

      Reply
      • Geir says

        October 29, 2012 at 11:45 am

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

        Reply
  4. Mark Seymour says

    November 13, 2012 at 2:21 pm

    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)

    Reply
  5. Olga says

    November 14, 2012 at 7:55 am

    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,
    Olga

    Reply
  6. Nathan says

    May 17, 2013 at 4:23 pm

    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?

    Thanks.

    Reply
    • davidjpp says

      November 29, 2013 at 9:16 am

      There should not be any issue … which version of Visio?

      Reply
  7. Potatobean says

    May 21, 2013 at 6:36 pm

    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?

    Reply
  8. Jeff Andres says

    August 28, 2013 at 4:41 pm

    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

    Reply
    • davidjpp says

      January 20, 2014 at 9:15 pm

      Open the Drawing Explorer.
      Expand the Masters branch
      Find the incorrect master, and delete it

      Reply
  9. Constantin Velásquez says

    January 20, 2014 at 8:45 pm

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

    Reply
    • davidjpp says

      January 20, 2014 at 9:11 pm

      I just tested it … it works for me, but I have sent you the files directly.

      Reply
  10. Yuri Weseman says

    March 16, 2014 at 7:55 pm

    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?

    Reply
    • davidjpp says

      March 16, 2014 at 8:33 pm

      OK, I will test it out

      Reply
      • Benjamin Jacobs says

        March 31, 2014 at 7:38 pm

        same problem here … do you have a solution yet ?

        Reply
  11. ChrisWuehrer says

    July 29, 2014 at 3:36 pm

    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…

    Reply
    • davidjpp says

      July 29, 2014 at 3:42 pm

      Oh dash!
      Did I use .Formula rather than .FormulaU ?

      Reply
      • davidjpp says

        July 30, 2014 at 8:27 am

        No, it wasn’t that. I think it was Double in VBA for Germans uses a comma for the decimal separator. I have amended the vss on OneDrive.

        Reply
  12. aaron moorcroft says

    August 20, 2014 at 12:39 pm

    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

    Reply
    • davidjpp says

      August 20, 2014 at 1:25 pm

      It is most definitely possible. In fact, if you look at the Visio Extras\Icon Sets stencil you will find a variety of useful traffic lights already. They have a Shape Data row labeled Display Icon which can be changed from 0 to 5, thus changing the appearance. All you have to do is link a recordset, add a text data graphic, and then enter suitable formulas to change the number in the Display Icon.

      Reply
      • aaronmoorcroft says

        August 20, 2014 at 1:40 pm

        Thanks for the speedy response your an absolute star, ill give that a shot, Thanks again sir 🙂

        Reply
        • davidjpp says

          August 21, 2014 at 8:31 pm

          Oh dash … I couldn’t resist having a go myself too : http://blog.bvisual.net/2014/08/21/using-icon-sets-shapes-to-display-shape-data-values/

          Reply
  13. talulah1984 says

    October 28, 2014 at 12:54 pm

    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!

    Reply
    • davidjpp says

      March 18, 2015 at 8:35 pm

      OMG Louise

      Reply
  14. Lou Lowe says

    August 9, 2016 at 5:42 pm

    David,

    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!

    Lou

    Reply
  15. Caroline Rochon says

    October 31, 2016 at 4:55 pm

    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.

    Reply
  16. Geoff says

    November 2, 2016 at 6:59 pm

    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.

    Thanks

    Reply
    • Caroline Rochon says

      December 9, 2016 at 12:47 am

      How did you mae the icon larger?

      Reply
  17. Kim H says

    December 2, 2016 at 9:05 pm

    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.

    Reply
    • davidjpp says

      December 3, 2016 at 5:09 pm

      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.

      Reply
  18. Erika says

    June 8, 2017 at 2:31 am

    Hi! I’m very new to Visio. I’m trying to create Data Graphics for an Org Chart I’m creating. I want to use the “Icon Set” of Colored Shapes (using the circles), but they appear so large in each of my employee boxes. Is there a way to resize them? I’m using Visio 2010.

    Reply
  19. Tom says

    July 2, 2020 at 3:22 pm

    Incredibly helpful! Thank you for making your code available to the community so that we don’t all have to acquire those skills to enable better data graphics in our drawings.
    I was wondering, though, there is a second macro in the .vss file. It is called ChangeLegendTextOrIcon. Is there any information on how to use that one? And, as far as the new icon sets, is there any way to get rid of one or all? I saw that you can overwrite one, but haven’t seen how you can alter or remove one, other than that.

    Reply
  20. David Gordon says

    February 24, 2023 at 9:13 am

    David, you are a legend – excuse the pun!

    Reply
    • David Parker says

      February 24, 2023 at 10:10 am

      Why, thank you sir :0)

      Reply
  21. Caroline Rochon says

    October 29, 2016 at 1:59 pm

    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?

    Reply
  22. davidjpp says

    October 29, 2016 at 2:36 pm

    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?

    Reply
  23. davidjpp says

    December 10, 2016 at 7:52 pm

    I eventually got around to provising a blog article …

    Reply
  24. Caroline Rochon says

    December 12, 2016 at 12:43 pm

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

    Reply

Trackbacks

  1. US Election Special–Vector Visio 2003 – 2010 Icons « bVisual says:
    November 3, 2012 at 7:18 am

    […] Perhaps someone would like to make Data Graphic icons from them ? : http://blog.bvisual.net/2012/04/19/make-your-own-visio-data-graphic-icons-sets-automatically/ […]

    Reply
  2. A Table of Visio Data Graphic Icon Sets | bVisual - for people interested in Microsoft Visio says:
    March 18, 2015 at 11:02 am

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

    Reply
  3. Replacing Images in #Visio Shapes by Changing Data | bVisual - for people interested in Microsoft Visio says:
    January 10, 2019 at 3:54 pm

    […] be more adaptable for a lot of scenarios than trying to repurpose Data Graphic Icon Sets ( see  Make Your Own Visio Data Graphic Icons Sets … automatically). I also discovered that the Shape.ChangePicture(…) function can just as easily work with urls as […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Update to LayerManager add-in for non-English users
  • Pushing Data Visualizer in Visio beyond its limits
  • Pushing Data Visualizer in Visio to the limits!
  • Teams Tuesday Podcast Recording about Visio
  • Linking Data to Visio Shapes in Code

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Themes Validation VBA Video Visio Visio 2007 Visio 2013 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • LinkedIn
  • Twitter

Search this website

Recent posts

  • Update to LayerManager add-in for non-English users
  • Pushing Data Visualizer in Visio beyond its limits
  • Pushing Data Visualizer in Visio to the limits!
  • Teams Tuesday Podcast Recording about Visio
  • Linking Data to Visio Shapes in Code

Copyright © 2023 · Executive Pro on Genesis Framework · WordPress · Log in