Prevent Sending Emails Without Subject Line From Outlook

Outlook_LogoCreating a subject line is like creating a work of art. This line says how important it is to have subject when we send emails.Sending mails without the subject has always been a problem for most of us. Most of us forget to fill the subject line due to some reason or the other. Gmail and Rediffmail take care of this problem internally. But Yahoo and Outlook doesn’t have any mechanism to stop such mails that doesn’t have subject. I might not be able to provide you a solution to prevent this from happening in Yahoomail. But I have a solution to prevent it in Outlook.

Outlook allows us to write macros, which would stop us sending mails without a subject. All we have to do is to write a macro and save it. That takes care of preventing us for sending mails without a subject line.

To create a macro that pops up and asks if we really need to send a mail without a subject, follow the steps

  1. Open outlook
  2. Press Alt + F11 or click Tools –> Macro –> Visual Basic Editor to open the VB editor
  3. Press Ctrl + R or click view –> Project Explorer to open the project on the left side pane.
  4. Expand Project1 and you would find “Microsoft Office Outlook Objects”, Expanding this would show you “ThisOutlookSession”.
  5. Double click on “ThisOutlookSession” and paste the following lines.

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

Save the project and close it. Now try sending an email without subject line. A message box would pop up saying that there is no subject line and would you wish to continue sending the mail. Clicking “yes” would continue sending the mail and Clicking “No” would stop your mail. That’s it. Now you have an option to pen down your subject line even if you had forgotten it earlier. :-)

30 thoughts on “Prevent Sending Emails Without Subject Line From Outlook”

  1. The steps work fine.. but only for the current session.. if you restart outlook or the system.. it wont work. We need to change the security setting in outlook to make sure that the macro is enabled during any session..
    1. In the Tools menu, click Trust Center.
    2. Click on Macro Security.
    3. Now Click the options that you want:
    i. No warnings and disable all macros Click this option if you don’t trust macros. All macros and security alerts about macros are disabled.
    ii. Warnings for signed macros; all unsigned macros are disabled This is the default setting and is the same as the Disable all macros with notification option, except that if the macro is digitally signed by a trusted publisher.
    iii. Warnings for all macros Click this option if you want macros to be disabled, but you want to get security alerts if there are macros present. This way, you can choose when to enable those macros on a case by case basis. (My Recommendation)
    iv. No security check for macros (Not recommended) Click this option to allow all macros to run. This setting makes your computer vulnerable to potentially malicious code and is not recommended.

    If you select option (iii), then after restarting Outlook there will be a pop-up that will ask whether to enable or disable the Macro…. (Always Select “Enable Macro”, to get the proper functionality)
    If selected option is (iv), the functionality will still be proper, but its recommended that you don’t play with security levels.

  2. Working for me after I replaced the quotes.
    Thanks a lot. I just sent a mail to my boss with no subject and i think he didn’t liked it.
    So, you saved me.

  3. In Outlook 2007 the macro worked the first time I sent an email without a subject. When I closed Outlook and restarted, the macro did not seem to run on Send. I then changed the macro security to “Warnings on all macros”. This di not work either until I recycled Outlook and the I get the message that ThisOutlookSession macros have been disabled. I enabled them and the macro worked correctly.

    Major kudos to someone who can tell me how to enable THIS macro to always run (without enabling all macros).

  4. Thanks – I needed this! The lines with quotes were shown in red (compile error). I had to replace the quotes to work properly. Seemed to be wrong font so VB did not recognise it as a quote.

  5. Thanks, this code works great with Outlook 2007! My only misgivings is allowing all Macros, in order for the code to run correctly.

  6. Working great!

    I just had to copy the code to word and change the Font.

    It was something with the quotes (“xy”)

    Thank you

  7. I need certain words to always appear in my Outlook subject line (Like my company name with the option to add to it)- is this possible? can anyone help me set this up????

  8. Not working for me (‘m using 2007)
    “MsgBox “Please fill in the subject before sending”, vbExclamation, “Missing Subject””
    THis is filed is coming as red

  9. Hi,
    The macro is running fine.
    But when i lock my system and unlock it again…
    The VB editor window gets opened each time and has to be closed (which is very irritating :P )
    Please suggest some work around…

  10. try this:

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

    Dim strMsg As String

    Dim res As Long
    If Item.Subject = “” Then

    Cancel = True

    MsgBox “Please fill in the subject before sending”, vbExclamation, “Missing Subject”

    End If

    End Sub

  11. To enable this macro on startup, In Outlook 2007, select Tools -> Macro -> Security -> “Warnings for all macros” (or accept all macros).

    To use this setting, need to exit Outlook, and restart Outlook. On restart, you get warning about macros “ThisOutlookSession”. You need to enable macros on this startup warning.

  12. I need to add the word (Secure) in the subjectline of all emails that I send, reply or forward. How do I do this? Can somebdy help me pls.

  13. The Compile Error is due to the fancy quotes in the copy/paste operation from this web page. Just delete and replace the double quotes in lines 5 and 6.

  14. MS Office 2007. Followed the directions as above.

    When sending an e-mail w/o a subject, I get a message that says” Compile Error: Syntax Error. If I click OK, the line “Private Sub Application_ItemSend (ByVal Item As Object, Cancel As Boolean) is highlighted yellow.

    The lines starting Prompt$ and If MsgBox are red.

  15. go to TOOLS->MACRO->SECURITY and select warnings for all MACROS or no security for macros(this enables macros every time you restart outlook)

  16. Thanks! This is a great way to make Outlook behave more like Thunderbird.

    One problem I’ve noticed though, is that the macro is connected to “ThisOutlookSession” and seems to not run properly once Outlook is closed and reopened.

    I’ll do some experimenting and post if I find a solution, but if anyone knows how to make this persistent, please clue us in.

  17. Same with me also, my mails are going without subject line.I am not getting the pop up.
    Can anyone kindly look into the issue.

Leave a Comment

Your email address will not be published. Required fields are marked *