- Community Pick
- Experts Exchange Approved
One of the reasons I hadn't bothered to solve this problem is built into Visio: if your goal is merely to present Visio drawing pages to an audience, creating PowerPoint slides may be overkill. To present Visio pages, you can just use Visio’s full screen mode by pressing F5 and then navigating from page to page using the arrow keys or PageUp and PageDown.
A recent question here on EE revived my interest in a PowerPoint solution, however, and in one of those wonderful coincidences that sometimes happen, I stumbled across part of the answer while looking for something else!
I was rummaging in the Visio 2007 Software Development Kit (SDK) looking for a way to automate the creation of the very sophisticated time lines Visio can produce (more about that another time…). I did find a potential solution for that problem, but more relevant here, I also found a long-forgotten code sample to create one PowerPoint slide from one Visio page.
Between the PowerPoint code in the sample and the PowerPoint macro recorder -- don’t ever forget about this incredibly useful tool when you’re trying to write code for any Microsoft Office application -- I developed a working solution that saves each page of a Visio drawing as an image, creates a PowerPoint slide, and then inserts the image onto the slide. The program also positions each image in the center of the slide and resizes the image to fit.
The macro creates slides from the active Visio drawing, i.e., the one that is “on top” in the Visio Window. Therefore, to create a set of slides from a Visio drawing:
1) Open the Visio drawing containing the macro.
2) Open the Visio drawing that you want to save as PowerPoint. As an example, the figure below shows the first two pages of a 14 page process map.
3) Select Tools>Macro>Create PPT from Visio >ThisDocument>CreatePowerP
You should now have PowerPoint slides containing your Visio drawing pages as shown in this screenshot.
Notice that the macro creates a title slide and inserts the name of the Visio document from which the slides were made:
AUTHOR'S NOTE: Since writing the original version of this article, I've updated the macro code to eliminate the need for the manual steps described in the next six paragraphs. I've left the paragraphs here, however, because the underlying Visio behavior hasn't changed -- you may run into it if you're manually creating images from Visio pages.
When you try this for yourself, if it looks like the images on your PowerPoint slides are all different sizes, you're not seeing things. It turns out that when Visio creates jpg images, it ignores any part of the page that does not contain shapes. To say that a different way, a JPEG created by Visio only contains the shapes and objects on the page, consequently, the JPEG image may be much smaller than the size of the page.
To see an example, look at the side-by-side comparison below. On the left is the original Visio drawing page containing part of a flowchart; notice that most of the page is blank. The image in the PowerPoint slide on the right only contains the flowchart shapes. (For purposes of this article, I added a blue line around the actual image in the PowerPoint slide so you can see its boundaries.)
As a result of this Visio behavior, if you want to create a set of equal-sized JPEGs that contain entire Visio pages, it is necessary to place an object or objects at the edge of each page. The easiest way to do this is to create a background page if your drawing doesn’t already have one, and assign that background page to each foreground page.
On the background page, do one of two things:
- Add a rectangle that is the same size as the page, then set fill to No Fill and line color to the page background color, OR
- Add a small shape to the top left and bottom right corners of the page, then set line to No Line and fill color to the page background color.
Important note: in the first option, the line must have a color, just as in the second option the fill must have a color. If you set both attributes to No, the shapes will be invisible to the JPEG creation software and you'll be back where you started.
The screenshot below shows the background page I created for the Visio process map used above. As you can see, I used option 2 by placing tiny white squares in the upper left and lower right corners of the page. The screenshot also shows the line color and fill color settings for the squares -- No Line is highlighted for the line and the white color is highlighted for the fill.
If you'd like to create PowerPoint slides from Visio drawings you can download the code. Because I will undoubtedly update this macro periodically, I chose to post it on my web site rather than attach it to this article.
As always, I'd love to hear your thoughts and suggestions for improvements to this code -- just post them below.
by: DrDamnit on 2010-08-21 at 10:32:30ID: 18502
I would consider myself a sophisticated MS Office user, and as I read this, I was thinking "wow this is pretty cool." The primary disappointment I had towards the end was it left me wondering what does the entire procedure look like.
Many readers (myself included) are tutorial learners. We need pictures and to see it done.
For example, I am learning Beethoven's moonlight sonata today, and I got stuck on a measure on the 3rd to the last line of the whole thing. I can read the notes. No problem, but I need to hear it before I'll be able to get it right. So, I was coming to youtube to watch this: http://www.youtube.com/wat
The same thing goes for this article. If we can add some "this is how you do it" to the already existing "it can be done" parts of this article, then it will really take off.
Quite exciting.
So, let's add some screenshots and perhaps follow an example all the way through from start to finish. What do you think?