How to over come no subject mails in Outlook

Posted: November 30, 2007 in How To, Tips, Useful
Tags: ,

Forgot to mention subject while writing an official mail and feel bad later ???

Yes, it’s a concern for all. A mail without a subject brings a bad impression on us.

To avoid this, just follow the simple steps mentioned below and see the result. 🙂

1. Open your Outlook

2. Press Alt+F11. This opens the Visual Basic editor and then Press Ctrl+R which in turn opens a Project-Project 1 (left side)

3. On the Left Pane, one can see “Microsoft Outlook Objects” or “Project1”, expand this. Now one can see the “ThisOutLookSession”.

4. Double click on “ThisOutLookSession”. It will open up a Code pane.

5. Copy and Paste the following code in the right pane. (Code Pane) and save it.

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

6. Now whenever u try to send a mail without subject, it’ll raise a pop-up to remind you. Cool no?? 8)

Comments
  1. Jackie says:

    Found this with a Google search. I’m running Outlook 2007 and evidently it will not notify you if you try to send a message without a subject. I’ve followed the instructions above but it coughs up an error. The VB editor opens and the 1st line is highlighted. Any ideas? I know nothing about VB.
    Thanks!

  2. gangu says:

    Hi Jackie,

    I struggled a lot to replicate the same error in my Outlook and finally got what could be wrong in there.. 🙂

    If I am not wrong, you have just copy-pasted the above code in that code window. In fact, I have asked to do that much only but there is a small correction.

    When you copy-paste the code, those double quote(“) are not taken as the intended double quote but some junk characters. (may be some codec problem but not sure what is that) Just delete those quote and type-in fresh double quote characters, it should work fine.

    Let me know the result.

    Cheers!

    • Dwval says:

      This fixed it not working for me in 2007. Re-type all quotes, then exit outlook and restart it. You should get a warning about macros, hit enable.

      Thank you!

  3. Archana says:

    hi i have done as said above still i can send emails without subject.

  4. Heavy says:

    The syntax will still not work unless you change “Check for Subject” to “Check AND Subject”.

    Change that and your script should work fine.

    • thiendiatuyet says:

      No, this is not the problem. If this doesn’t work, then there could be some problems with the macro security issue. Go to Tools -> Trust Center. On the left hand side of the Trust Center panel, click Macro Security. Now make sure you have either the Warnings for all macros or No security check for macros checked. If you choose the Warning…, then every time, you start the Outlook, you will get a warning and macros disable. Choose enable macro at the bottom. Have fun. 😉

  5. Gangadhar says:

    @ Archana
    sorry for late reply. i think there is some basic problem, not with the script, because it worked for me, at least for the first time. but now it is not working for me also, don’t know why. ‘ll come back with the solution soon.

    @Heavy
    sorry dude, it didn’t work. plz let me know on which version of MS Outlook it works. Mine is MS Outlook 2003. Thanks in advance.

  6. Kanishk says:

    Hi,

    The rule worked only once. When i restarted the PC, wasnt working anymore 😦

    • thiendiatuyet says:

      If this doesn’t work, then there could be some problems with the macro security issue. Go to Tools -> Trust Center. On the left hand side of the Trust Center panel, click Macro Security. Now make sure you have either the Warnings for all macros or No security check for macros checked. If you choose the Warning…, then every time, you start the Outlook, you will get a warning and macros disable. Choose enable macro at the bottom. Have fun. 😉

  7. Paulraj says:

    Thanks your information

  8. Gandalf says:

    Sometimes compiling the Script (it’s in the Script Editor’s Menu) helps

  9. LatinKnight says:

    Works perfectly fine for me 🙂

  10. Nitin says:

    It does not work on my system 😦

    is there any basic problem in the code with Outlook 2003?

  11. Gangadhar says:

    Hi Nitin,

    I really don’t think there is problem with the code.
    Anyway, let me dig out for more info on how to make it work with Outlook 2003 and get back to you.

  12. Nabil says:

    Hii

    I want the process where i should recived the any POP for only no subject mails in outlook 2003 now if i will assinged same process it is working but for all mail where i have insreted the subject also i am getting the pop so what should i do in this case

  13. Gangadhar says:

    Hi Nabil,

    Please make sure that you have the correct code in your outlook session. I mean check whether you have used the same variable (“Item” in this case) and see that you haven’t ended the outer IF loop abruptly, etc.. I really don’t see any issues with the code.

  14. Ali says:

    Hi
    I wanted to publish this macro in all computers in a domain,but it didn’t work.Could I use my exchange server to avoid sending message without subjects?

  15. thiendiatuyet says:

    If this doesn’t work, then there could be some problems with the macro security issue. Go to Tools -> Trust Center. On the left hand side of the Trust Center panel, click Macro Security. Now make sure you have either the Warnings for all macros or No security check for macros checked. If you choose the Warning…, then every time, you start the Outlook, you will get a warning and macros disable. Choose enable macro at the bottom. Have fun. 😉

  16. Ambarish says:

    Hi thiendiatuyet,

    I could find the script at n number of sites online.
    BUT it worked only once for me & for so many of them out there.

    But I made the changes suggested by you & it’s working for me damn every time!
    You are a problem solver!

    Three cheers to you,
    -Ambarish 🙂

  17. Francis Moeris says:

    Thank you very much for this. It works !
    Kind regards
    Francis

  18. Dan Denov says:

    Thank you for the provided code, also for the correction on manually refilling the double quotes. It worked for Outlook 2003 and solved the annoying problem on sending emails without subjects.

  19. Ganesh says:

    hi thiendiatuyet,

    Excellent. It worked for me after applying your workaround.
    Thanks

  20. Vimal says:

    Guys it worked for me .Thanks
    tat was kool

  21. Salomão says:

    Works perfectly fine for me. This is what I need.
    I had to change the security on the trust center to work after restarting Outlook.
    Thanks for the code.

  22. erolmacc says:

    I found the same code at other site, but and had a problem in the first line when the variables are declared. This one is the same but it works fine!

    Does anybody know something similar but for attachment file missing? i tried a couple of add-ins but one is just a trial and other one simply doesn’t work

  23. Sachin says:

    Hi

    this is realy helpful, but I am facing some issue with this.
    I am using two outlook clients on my machine am able to save this script for one of the client but cannot save the other one giving error “The saved failed. this could be because there was not enougf hard disk space or, the project file is read-only”
    can any one tell me what should I do to save this script.

    currently am using Outlook 2003. and both the mail client are using exchange server

  24. Ed Chiodo says:

    Didn’t wok for me until I retyped the double quotes.
    THANKS!

  25. Srinivas Cheemakurti says:

    Hi,

    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)

    Code:

    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!

  26. seba says:

    thanks helped me a lot

  27. Mick says:

    Did work until I restarted Outlook. pity you couldnt keep these changes

  28. Leigh says:

    Thanks for this. I had the double quotes problem too, but it works like a charm now that I’ve replaced them.

Leave a reply to Gangadhar Cancel reply