[How-To] Write Macro For Blank Subject Warning In Microsoft Outlook
Has it ever happened to you that you wrote an interesting, meaningful, content rich email but forgot to put a subject before you pressed the Send Button. Earlier, i wrote about writing a Macro for not missing attachments (Read: [How-To] Missed Outlook Attachment,get warned before its too late)
In this article, we will write a Macro for validating Blank Subject in Microsoft Outlook client. Follow the steps below in order to create such a macro
1.) Ensure that Macros are enabled for your Microsoft Office Outlook. Macros don’t work with Microsoft Outlook Express, therefore this setup cannot be achieved with Microsoft Outlook Express.
2.) Ensure that your security level is set to Medium. You can set the security level by clicking on Tools –> Macro –> Security. Set the desired level to Medium.
3.) Traverse through Tools –> Macro –> Visual Basic Editor ( Or press ALT + F11)
4.) Expand Project 1 by clicking on the + sign.

5.) Expand Microsoft Office Outlook Objects.
6.) Double click ThisOutlookSession.
7.) Copy paste the following code.
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

Image: Macro for validating empty subject line in Microsoft Outlook.
8.) Once the code is pasted, click on Save and then Exit. The above code ensures that when you send an email, the subject line is not blank. If, the length of the subject line is zero, the macro alerts you with a popup.
Am sure, once you have created this macro, you will be able to avoid sending blank subject emails.
Also Read: Recovering ‘permanently’ deleted email in Microsoft Outlook 2003
Recovering Hard Deleted Items in Outlook 2003.
You can follow me on Twitter at http://twitter.com/vaibhav1981
Do stay tuned to Technofriends for more, one of the best ways of doing so is by subscribing to our feeds. You can subscribe to Technofriends feed by clicking here.
Related posts:
- [How-To] Missed Outlook Attachment,get warned before its too late
- [How-To] Edit a Received Email Message in Microsoft Outlook
- Send SMS messages from Microsoft Outlook with Microsoft Outlook SMS Add-in (MOSA)
- How-To: Stripping attachments from Microsoft Outlook.
- Send Large Files From Microsoft Outlook using YouSendIt
Thanks for this tip, but it works only for one session when Outlook is open. If you close and start outlook, it doesnt work.
The code works fine as long as you are in the same session when the script has been saved. Though it is still saved in the macros, it doesn’t work upon restart of outlook. This is in Outlook 2007.
I found the answer. It is here
http://www.codeproject.com/KB/Blogs/outlookblanksubject.aspx
Thank you!!!!!
very very helpful and clear!