A Better Way To View Multiple Picture Attachments

ANOTHER UPDATE:  The content of this article is superceded by a newer version with more features, outlined in this article on MSDN:

Office Developer Center: Viewing Multiple Picture Attachments in Outlook 2003:
http://msdn.microsoft.com/en-us/library/office/aa168469%28v=office.11%29.aspx

UPDATE: The information in this post is really intended for those of you who have some decent experience programming within the Outlook VBA Editor.  I never meant for this to be consumed by general users, so if you don’t know how to set references to Type Libraries, create User Forms or compile and debug VBA, then you know you are not the intended audience.  I may redo this solution as a downloadable, installable COM Add-In sometime – for use by ALL Outlook users – so stay tuned…

This is one of my most heavily used weapons in my Outlook macro arsenal, and saves me a lot of grief. Take a look at the screenshot below:

olpicattachments1

Doesn’t this drive you nuts? You can select all of the attachments in an e-mail, but you can’t launch all of them at the same time. You have to double-click each one individually. I’m sure there’s been many times when you’ve received an e-mail from one of your friends with 15 joke pictures, or Aunt Rose sends you 5 photos of her new cat, and it quickly becomes a real chore to open – view – close every single attachment.

Read on, and I’ll show you the code for a much better way to handle this.

The Message Attachments Form

Ultimately, this is what you will see when you click a custom button on one of your toolbars:

olpicattachments2

This form will contain a list of all the picture attachments in the current message (those with .gif, .jpg, .tif or .bmp extensions; you can enter additional ones in the frmAttachments.FillList procedure). You can selectively choose non-contiguous entries in the list with Shift-clicks, all entries, just one attachment (double-clicks are enabled), and then click a button to show the picture(s).

Launching the Message Attachments Form

First off, to launch this form, create this macro and put it either in your ThisOutlookSession module or any Modules you have in your VBA Project:

You’ll also need to create a custom button on one of your message Toolbars. To do this, choose Customize from the Toolbars sub-menu under the View menu of your message. Click the Commands tab, choose Macros from the Categories list, and select OutlookVBA.ViewAttachments. Now drag that to a spot on any of your Toolbars and you’re good to go.

Message Attachments Form Code

Here is the code for the frmAttachments UserForm. Rather than recreating the UserForm yourself, you can download the file to save yourself some trouble. I’ll include the code here for reference anyway:

Final Comments

You might notice that I’m using Internet Explorer to launch the images. I can’t assume what you are using as the default image viewer on your PC, but IE is always there (!) so I chose that. Feel free to change the viewer to whatever you like. See the inline comments in the code for more information. Have fun using this! I hope it makes your life easier when working with multiple picture attachments.

—————————————————————-
COMMENTS RESTORED FROM BACKUP:

Sun 6/5/2005 11:40 PM Jimmy

“Hi Eric .. I get a compilation error for the line “objFs As New Scripting.FileSystemObject”. It says “User defined type not defined”. Please help!

Jimmy”

Mon 6/6/2005 1:15 AM Jimmy

“”90
Object variable or with block variable not set

[error in cmdOpen_Click]

This is the error I got while trying to open any picture attachment. Anyone got that problem?”
Mon 6/6/2005 6:50 PM Jimmy

“Thanks for that Mate, now I got this runtime error
“91
Object variable or with block variable not set

[error in cmdOpen_Click]

This is the error I got while trying to open any picture attachment. Anyone got that problem? ”

END COMMENTS RESTORE
—————————————————————-

Eric Legault

Microsoft Outlook MVP (15 yrs). Author: Microsoft Office 2013 Pro Step By Step. Consultant/speaker/Outlook add-in builder/SharePoint pioneer. Guitarist: Maiden Canada (Iron Maiden tribute band)

You may also like...

%d bloggers like this: