Tuesday, September 05, 2006

HOW TO: Not forget attachment or subject line using Outlook macro


Following VBA code will remind you if you are sending an email with empty subject line, or when you forget the attachment. It checks mail body for word "attach" and then confirms if something is really attached. If you attachment is missing, it will pop-up a dialog box.

The setup

  1. In your Outlook 2003, invoke Visual Basic Editor, either by pressing Alt+F11, or navigating the menu as "Tools->Macro->Visual Basic Editor"
  2. In the Left hand side "Project" panel, make sure entry named "ThisOutlookSession" is highlighted.
  3. Copy paste the code given below in the Right hand side Panel.
  4. Exit out of VB Editor by either Alt+Q or by navigating the menu item File->Close.
  1. Make sure that the security is set to "High" (Tools->Macro->Security)
  2. The changes we made will NOT work with High security, so we need to "certify" our code, so that it always works.
  3. Invoke "selfcert.exe" from "C:\Program Files\Microsoft Office\OFFICE11\SELFCERT.EXE"
  4. In the dialog that pops up, Type your name.
  5. Go back to Visual Basic Editor (Alt+F11 from Outlook)
  6. Navigate to Tools->Digital Signature.
  7. Click "Choose"
  8. Select your name, Click "OK"
  9. Click "OK" to come out of "Digital Signature" dialog.
  10. Exit out of VB Editor (Alt+Q)
Activating the Macro
  1. Restart your Outlook
  2. When asked about macros, select "Enable Macros"
  1. Try sending an email with empty subject to yourself, to test if everything works.
  2. Type "attach" or "attached" in email body and send email to yourself without actually attaching any file.
.. finally "The Code"

Please refer to my earlier post here


Anonymous said...

This is a good idea. I don't know how many times I've sent out an email referencing an attachment and forgotten to include it.

Mark Shead

Anonymous said...

Awesome tip. Worked great...much appreciated.

Elizabeth said...

I found the code for this fix several places and searched high and low on how to install it (not being familiar with VBA.) I was happy to finally find this information spelled out here.

Unfortunately, the pop up reminder box comes up behind my New email window. (It does lock the mail until "OK" is clicked on the box, so that can serve as a "reminder".)

I know this is an old post, but if anyone knows of a way to get the box to appear on top, I'd appreciate it.