The other day a customer told me he was “sick and tired” of people asking him to export shapes from Visio to a PNG file.
The customer works for a relatively small company that only has 1 Microsoft Visio license available. Other people in the company need the shapes on a regular basis for use in Word or Powerpoint documents.
I started out by showing him how to export a shape using a Macro in Visio, which eliminated several steps in exporting to PNG format.
Several minutes later I used the same Macro to run through ALL the shapes in ALL the stencils the customer had. All shapes were now exported to PNG on a file share. Problem solved.
For anyone with the same needs, I published the macro enabled Visio file on the TechNet Gallery here.
Usage is actually quite simple.
- Open the ShapeExporter.vsdm file making sure you allow Macros to run.
- Add one or more stencils to the ShapeExorter document.
- Click the “Export Shapes” button, or run the Macro from the Developer Ribbon.
- Check the results :)
It exports to %UserProfile%\Desktop\Shapes but you can change this if needed, just edit the Macro.
This screenshot clearly shows the Export Shapes button.
Add at least 1 stencil:
And click the Export Shapes button. Note that this can take a while if you have a lot of stencils added, or if there is a large number of shapes to be exported.
Just be patient until a little message pops up:
Then check the results on a Shapes folder on your desktop (if you didn’t change the output path in the Macro):
So there you have it. It took longer to create the screenshots, upload to the TechNet Gallery and write a blog post about it, then it did creating this, but hey, it gets the job done, and I’m sure someone will find use for it :)