Monday, February 15, 2010

Import a folder of pictures to PowerPoint slides

My father has a project he's doing for presentation to a local historical society. Part of this project appears to involve documenting a bunch of photos, and also presenting them. He asked me the other day to give him a tutorial on adding photos to PowerPoint slides, at which point he'd take about 120 photos and manually place them.

Thinking of doing anything manually in MS Office made me cringe a bit. So I offered to build him a VBA macro to place the photos for him, provided that he populate a folder with all the images he wanted, then he could hit a button, pick the folder, and get a PowerPoint presentation with all his pictures placed.

Anyone who's written VBA for PowerPoint could figure out how to do this in a trice, but here I've provided an unlocked PPT file with all the code you need.

It seems to work fine for me, and you can do what you want with it.

You can download it here.

Thursday, August 20, 2009

Power Point Picture Synchronization

Some time ago I worked on a project where I was automatically generating/regenerating png graphics of some business diagrams and thought of how someone would be able to use these in a PowerPoint presentation.

Typically users go to Insert->Picture->From File, and select a picture to insert into a presentation. You have two options in PowerPoint for how to store this image: either embed a bitmap in the PPT file or have PowerPoint link to the file, meaning PowerPoint loads the image fresh every time you start PowerPoint.

So if you have constantly changing graphics, it's a great idea to use the linking functionality. Now no matter what you'll always have the latest and greatest version of that graphic in your presentation.

But what if you want to send someone else that file? If you email someone the PPT file with a linked image, PowerPoint will be looking for that image file, so you have to send that picture along and have the recipient store their file in the same location. You could argue that you can put it on a shared drive, but what if your recipient is off the network?

I tackled this problem by building an addin for PowerPoint in VBA. The addin creates a toolbar with buttons that allow you to import a linked image to a presentation. The addin stores the path to the image file, but also stores a local copy of the image. Every time you open the presentation (with the addin enabled), the addin simply checks the modification date of the file versus the date when the image was updated in PowerPoint. If the linked image has been modified, the addin simply swaps out the old image with the new one, maintaining animation options and size.

This software is provided as is for use however you want, with no warranty or guarantee of how it will work.

I've tested the addin with PowerPoint 2003 and 2007. You can download it here. To install it simply copy the PictureSync.ppa file to %appdata%\microsoft\addins

Then open PowerPoint and enable the addin. The toolbar will appear in PowerPoint 2003, and will appear in the Addins ribbon tab in PowerPoint 2007.

If you have any questions of comments let me know here.