Macro to Warn Before Sending a Message with a Blank Subject

Last reviewed on January 14, 2013

Outlook 2010 added a feature to check for a blank subject. Surprisingly, some users hate this and there is no way to disable it using Outlook options. If you are looking for a way to disable that warning, you can disable the warning using a macro.

Anyone using an older version of Outlook who wants a warning when the subject line is blank needs to use a macro.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
 Dim strSubject As String
  strSubject = Item.Subject
     If Len(Trim(strSubject)) = 0 Then
         Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"
       If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
        Cancel = True
      End If
    End If
End Sub

How to use this macro

Using a macro in Outlook, short version:

  1. Step 1: Enable macros in Tools, Macro Security or Tools, Trust Center (Outlook 2007). We recommend the 'warn for all macros' setting (Medium in Outlook 2003 and older). With this enabled, you'll need to allow macros each time you start Outlook. In older versions of Outlook, you may need to close and restart Outlook before the macros will work.
  2. Step 2: Open the VBA Editor using Alt+F11 keystroke.
  3. Step 3: Expand the Project menu and select ThisOutlookSession
  4. Step 4: Copy and paste the macro into ThisOutlookSession. The text should be blue, green and black. Red text means there is a syntax error in that line.
  5. Step 5: Save (Ctrl+S or Save button). Note: you'll need to save the VBA project when you close Outlook too.

Test the macro by sending a message with a blank subject.

Blank subject warning

If it works as expected, you can use SelfCert to sign the macro then set Outlook's macro security to signed macros only. Instructions for using SelfCert are available at How to use Outlook’s VBA Editor

Warn before doing other stuff...

You can use this to warn about things beside a blank subject. Depending on what you are checking, you will need to either remove or edit the first two lines:

Dim strSubject As String
strSubject = Item.Subject

Then change the IF statement to test the field you want to test:
If Len(Trim(strSubject)) = 0 Then

For example, to check the TO address, we need to change those lines to this:
'Item = MailItem
If Item.To = "alias@domain.com" Then

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

   'Item = MailItem
     If Item.To = "alias@domain.com" Then
         Prompt$ = "Are you sure you want to send this message?"
       If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check before Sending") = vbNo Then
        Cancel = True
      End If
    End If
End Sub

More Information

More Code Samples:
E-Mail: Check item size before sending

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

If the Post Coment button disappears, press your Tab key.