A Simple Aid to Avoid Email Embarrassment

March 4, 2010

Yesterday, I was watching one of the podcasts I regularly view, and they mentioned that on gmail there is a feature that will notice if you’ve typed something like “I’ve attached the file you wanted” and clicked “send” without actually attaching a file. If it sees that, it will give you the chance to cancel sending the email. I know this has happened to me several times over the years and has happened to many people that send me emails as well. And it’s always a bit embarrassing to the sender when it happens. But of course most of the times it happens to us we’re using Outlook since that is what our companies use. So of course my first thought is “Gee it’d be great if Outlook had this feature too”. It turns out that it’s really not that hard to add it to Outlook (assuming your security settings allow it). These are the steps that worked for me, your VBA may differ…

  1. Open Outlook
  2. Press Alt+F11 to bring up the VBA interface
  3. expand the project tree on the left to get to the ThisOutlookSession object and open it
  4. In the code window that pops up enter the following:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
If Item.Attachments.Count = 0 Then
ans1 = MsgBox("There's no attachment, send anyway?", vbYesNo)
If ans1 = vbNo Then Cancel = True
End If
End If
If Item.Subject = "" Then
ans2 = MsgBox("There's no subject, send anyway?", vbYesNo)
If ans2 = vbNo Then Cancel = True
End If
End Sub

  1. Save
  2. Test it out by opening a new email, typing something like “I’ve attached the file you needed”, setting a recipient, and clicking “Send”.

You’ll notice that I also added some code to handle blank subject lines as well (another pet peeve of mine).


If the change stops working after a restart of Outlook, check your macros security settings. You’ll want to change it from “Warnings for signed macros; all unsigned macros are disabled” to “Warnings for all macros”. Either that, or sign the macro.

That would have been a follow-up comment, but I can’t seem to post comments currently…