Wednesday, April 14, 2010

Preventing Emails with Blank Subject Lines in Outlook

Here is a nice fix to prevent Outlook from sending emails without anything in the subject:

Save yourself the annoyance by following the next steps.
  1. Open the Visual Basic Editor (in Outlook, press ALT+F11).
  2. On the left-hand side of the screen, expand the ‘Project1 (go into ‘Microsoft Office Outlook Objects’ -> ‘ThisOutlookSession’).
  3. Double click on ‘ThisOutlookSession’
  4. Paste the following lines of code in the right-hand pane of the screen:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Subject = "" Then
    Cancel = MsgBox("This message does not have a subject." & vbNewLine & "Do you wish to continue sending anyway?", vbYesNo + vbExclamation, "No Subject") = vbNo
    End If
End Sub

Save the project (‘File’ -> ‘Save’) and return to Outlook. From now on, the code will be called every time you press the send-button after you composed an email. Outlook will pop up a warning when you try sending an email with an empty subject line.

No comments:

Post a Comment