How to prevent Outlook from sending an email with a blank Subject line?

18Apr07

How to prevent Outlook from sending an email with a blank Subject line?

Sometimes we forget to put the SUBJECT in the mails which we send. That could be deadly sometimes when you are communicating to the clients; to avoid such a situation, follow the steps below. There after when you send a mail without subject, a pop up window asks for your confirmation. You can try it !Steps:
1.Open your outlook
2.Press Alt+F11. This opens the Visual Basic editor
3.On the Left Pane, one can see ” Microsoft Outlook Objects”, expand this. Now one can see the “ThisOutLookSession”.
4.Click on “ThisOutLookSession”.
5.Copy and Paste the following code in the right pane. (Code Pane)

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(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

6.Save this and Now close the VB Code editor.
7.In Outlook Go to Tools > Macros > Security > In the Security Level Tab > Select the option MEDIUM > OK
8.Now Restart the Outlook, a dialog box pops up to Disable / Enable the macros; select as Enable Macros (this option will pops up when ever you restart outlook.
9.From now on , this macro will make sure you do not make the mistake of sending a mail without subject

That’s it!



8 Responses to “How to prevent Outlook from sending an email with a blank Subject line?”

  1. 1 Madhuk

    Hi, thank you for this great post. I had already made the mistake of sending the mail without a subject line. I will make sure i and others would not repeat this mistake.
    Thanks you very much.

  2. 2 Terrence John

    Hi,

    Thanks for the guidance, however this does not work for 2007. Could you help us out with that?

    Regards,
    Terrence J.

    • 3 Shashank Saxena

      Che have to done this setting also in Outlook 2007 for subject line empty error

      After doing above
      go to.
      Tools->Macro->Security Select “Warning for all macro”
      Logoff / Exit outlook
      Open outlook, Select “Enable Macro” and then Check.

      It’s dosen’t worked for me.. check if works for you..

      Regards
      Shashank

  3. 4 Suresh

    Thanks mate,

    This one was really helpful, keep up the good work.

    If you can, please give your email address, so that I could get your advice for things like this in the future

    Once again thank you very much

    Regards,

    Suresh

  4. 5 Bipul Kumar

    Hi,

    Thanks for the post. I need some more help in this. With this code, when we click on no. button of the pop up, massage gets dispared. I want to keep my new massage box opened. So that I can enter subject and then send the same mail.

    With the above code this is not possible, Can you please resolve this issue as well.

    Thanks
    Bipul K

  5. 6 Shashank Saxena

    Hi, This is a nice script but it doesn’t works in MS Outlook 2007.

    Any Help will be appriciated.

    Regards
    Shashank

  6. 7 RichCowell

    This doesn’t work on Outlook 2007.

    When sending any email, whether it has a subject or not, it opens up Visual Basic, highlights the “Prompt$ = “Subject is Empty. Are you sure you want to send the Mail?”” line, and pops up a “Compile error: Syntax error” box.

    Clicking OK, then closing visual basic, sends the email anyway…

  7. 8 Stephane Leclair

    The script works, but on this site it’s formatted with elegant quotes “like these” instead of the strict ASCII quotes. You have to change the quotes to straight ASCII quotes for it to work. My Outlook showed the affected lines in red, just replace all the quotation marks.

    If you keyboard won’t let you type a straight quote for some reason, you can try this: hold down the left ALT key, press 3 4 on the numeric keypad, then release the ALT key.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.