Last reviewed on January 14, 2013   —  16 Comments

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.
    Allow macros to run
  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 = "" Then

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

   'Item = MailItem
     If Item.To = "" 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


  1. jon says

    Can this be modified to popup a message whenever I email a particular address? I just want to have that extra reminder to remove financial information from our board meeting minutes before I send them to a particular person.


    • Diane Poremsky says

      Yes, it can. Remove the Dim line, change the subject and if line to the following -

      Item = MailItem
      If Item.To = "" Then

  2. Candice says

    This works perfectly for me, but instead of warning when I send to a particular e-mail address, I need it to warn me before I send to one of the company's distribution lists. I can't get the macro to recognize addresses that are stored in our company's Global Address book.

    • Diane Poremsky says

      Using the display name works here:
      If Item.To = "Submissions" Then

      Because DLs are expanded on the server, if you need to check for a member of a DL, you'd need to expand the DL using code then look for an address using InStr function. Also, the macro is case-sensitive - you can use lcase to make it insensitive.

  3. Prakash says

    I want to give Warning message ,before sending mails containing following keyword "enjoy", "Fun" , "Party" , Please be careful ,don't send this type of mails.

    Only Warning, before sending. Please guide

    • Diane Poremsky says

      You'd use this format: instr(1,"keyword") > 0 but because you want to use multiple keywords, you'd use an array or case statement.

      select case instr(1,strKeyword)
      keyword "enjoy", "Fun" , "Party"
      ' code to do is there is a match
      end select

  4. Miles says

    I would love to Add company Logo to this message ? I have change to are you sure you are sending this to the correct recipient ? - I feel the company logo will make it look more professional , can this be done ??

    • Diane Poremsky says

      You can't use a logo with the msgbox - you could if you created a userform, but that takes away from the simplicity of code.

  5. Shashank says

    The one for subject did'nt work for me....gave me a expected end of statement error...
    This worked for me though (Outlook 2007)

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

    If Item.Subject = "" Then

    MsgBox "You forgot the subject."

    Cancel = True

    End If

    End Sub

    • Diane Poremsky says

      The only issue is that adding a space to the subject field will bypass the check. This will strip leading/ending spaces from the subject and trigger the message if the subject only contains spaces.
      If Len(Trim(strSubject)) = 0 Then

  6. dpons039 says

    Hello, I really love this warnings and I'm using them regularly.

    I need to have one to check if the subject has an specific word "test"

    If Subject has "test" -> Send email
    If Subject does not have "test" -> Warn if you want to send it.

    Thank you Diane!

    • Diane Poremsky says

      You'd add another if:
      If Len(Trim(strSubject)) = 0 OR If instr(lcase(strSubject, "test")) = 0 Then

      by using lcase, it works with any case: Test, test, TEST, tEsT etc.

    • dpons039 says

      Hello Diane,

      That doesn't seem to work, i'm geting a:
      compile error - Expected: Expression.
      I'm at Outlook 2007

    • Diane Poremsky says

      User error :-) This is the correct format for the line:
      If Len(Trim(strSubject)) = 0 Or InStr(LCase(strSubject), "test") = 0 Then

      That should teach me not to copy and edit a line instead of just typing it in from scratch. :)

  7. rohitrajsbl says

    Hi Everyone,
    I want to create a Macro in outlook 2013. If I am attaching anything in email then a popup box should appear with the statement “You are attaching a file. Please check if XYZ field available in the file” Presse YES or NO. Also in the popup box should be one check box If I checked the button then a note should be include with the email.

    Please help me to solved this out.

Leave a Reply

Please post long or more complicated questions at OutlookForums by

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