Automatically save Microsoft Outlook email attachments to disk

Learn about a customizable Outlook VBA script that automatically saves email attachments from Microsoft Outlook folders to disk.

Discover an easy-to-use and customizable Outlook VBA script that will drop email attachments into a specified Microsoft Outlook folder that then automatically saves them to a directory folder on disk.


I have a terrible habit of letting Microsoft Outlook .PST files bloat up with email attachments, because I never bother to dump the email that contains them (even if I no longer really need them). Manually removing attachments from messages can be laborious.

I've since discovered an Outlook VBA script that automatically saves email attachments and gives me an excuse to continue dumping attachments into my Outlook .PST files.

The macro script, authored by Killian, allows attachments to be automatically saved to a directory folder somewhere on disk whenever a message with an email attachment is moved into a specific "watched" Microsoft Outlook folder. These folders can be named anything you want, as the names are spelled out in the script itself and can be modified with relatively little work.

The Outlook VBA script can also be customized:

  • I modified the retention settings for the folder where the attachment-bearing messages are dropped so that they are automatically deleted after a few months. (In my experience, that's long after any use for the attachment has disappeared.)
  • I also commented out the part of the code that prints Excel attachments, since I didn't need that feature.

The VBA script works in Outlook 2002 and 2003, and I have also tested it in Outlook 2007. Regardless of version, however, you'll need to make the appropriate adjustments to your macro security settings to get it to work, since it's an unsigned macro.

About the author: Serdar Yegulalp is editor of Windows Insight, a newsletter devoted to hints, tips, tricks, news and goodies for all flavors of Windows users.

MEMBER FEEDBACK TO THIS MICROSOFT OUTLOOK TIP

I have a question on this tip and the handy script that you've referenced. I read the script and saw the code, but wasn't sure where to go for further reference.

Regarding the VBA script, there is a piece of the code that I'd like to modify for my own purposes.

    Set TargetFolderItems = ns.Folders.Item( _ 
    "Personal Folders").Folders.Item("Temp").Items

How do I modify "Personal Folders" to something else (i.e., NOT a PST)?

Let's say I have a mailbox called Mailbox - Brian Henderson and have the following folders:

Mailbox -Brian Henderson
   project 1
       folder a
   project 2
       folder b

Basically, I'd like to run this on all of my email folders and have them all output to different file folders. Is this possible?

This is a great article... it gave me some great ideas. Thanks so much for pointing it out!
—Brian H.

Do you have comments on this tip? Let us know.

Please let others know how useful this tip was via the rating scale below. Do you know a helpful Exchange Server, Microsoft Outlook or SharePoint tip, timesaver or workaround? Email the editors to talk about writing for SearchExchange.com.

This was first published in September 2007

Dig deeper on Microsoft Outlook

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

SearchEnterpriseDesktop

SearchCloudComputing

SearchSQLServer

Close