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:
- 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.
- Step 2: Open the VBA Editor using Alt+F11 keystroke.
- Step 3: Expand the Project menu and select ThisOutlookSession
- 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.
- 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.
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 = "firstname.lastname@example.org" Then
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 'Item = MailItem If Item.To = "email@example.com" 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 Code Samples:
E-Mail: Check item size before sending