Managing Email Attachments

Following on from the previous posting, I’ve been wondering what else to do with Outlook.

One thing that’s I’ve meant to sort out for a long time is managing email attachments (Word documents, PDFs, etc). My outlook.pst file is not far short of half a gigabyte, and presumably this is largely due to lots and lots of  message attachments. Nearly all of these will have been Saved As, but almost never Removed. It’s annoying that there isn’t a Detach operation that does both.

So what I’d like is an Attachments Manager. Yes, there are some out there, but it’s more fun to roll your own, and learn something in the process.

One issue to decide is whether we want the saving/removal to be done automatically, on receipt of the message, or manually initiated as a housekeeping task (or both). I think I’ll start with the latter, as it gives an opportunity to check an incoming message.

We’ll want to scope the messages being processed, for example by:

  • Folder (e.g. Inbox, Saved, all folders)
  • Date (e.g. older than)
  • File types for the attachments (e.g. only MS Office, PDFs)
  • Message title (or content)
  • Message sender.

We’ll also need to specify target folders for the saved files.

It would be good to maintain a link from the message to the saved file. I’m thinking this can just be a file:/// URL. We get a sort of back-link just by searching for the filename (I use the Lookout search facility).

Given that we want a degree of flexibility in setting up the processing parameters, a front-end user-form would be good. I can see this turning into a bit of a mini-project…


5 Responses to “Managing Email Attachments”

  1. 1 JP September 25, 2009 at 12:49 pm

    I’ve always done this manually, to maintain control over when and where attachments were going. What I did in the past was write and maintain several different procedures, each one saving the files to a different folder. This is because I already had event handlers moving different messages to different folders. Then I would just click on each folder and run the appropriate macro once or twice a week to purge it. In my case, they were always attachment-only messages, so I was free to delete them. Of course I saved the filename with the email received time, so I could always look at the file and figure out when it was received.

    Now I might just write one procedure and use a folder browsing procedure to pick the destination folder on the hard drive.

  2. 2 French September 26, 2009 at 7:06 pm


    I wonder why you want to spend so much time trying to develop something on your own, when outlookAttachView ( exists. Seems to be doing almost everything you want, and you don’t have to spend any time programming it.

  3. 3 Roy MacLean September 28, 2009 at 8:14 am

    I’m thinking of something a bit different from what you have there – more like a set of test-action rules that can be applied to sets of mail items, initially manually, but maybe also automatically (on receipt).

    More generally, this blog is about VBA programming, and looking at interesting (I hope) design problems. Whether or not solutions of some sort already exist isn’t my primary concern.

  4. 4 Grigory September 28, 2009 at 4:34 pm


    I have customized the solution as shown here: providing it with a couple of optional arguments. I can now call this routine from several scripts parametrized accordinglz. These scripts in it turn are activated by an Outlook rule, and it saves attachments (destination folder is to be defined, Delete original is optional) sorting them into numerous folders depending on the type of e-mail.


  5. 5 Roy MacLean September 28, 2009 at 5:29 pm

    Thanks for that. Rather than having a single large procedure, I’m going for an object-oriented approach, with MailItems being given to a chain of Rule objects. So that the Rules are persistent, and editable without going into the code, I’m using Notes as rule-definitions. More in due course.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

September 2009
« Aug   Oct »

%d bloggers like this: