Ever now and so often, it happens that I forget filling in the mail subject when composing an email in Outlook (typically when I have to send a rather important email…).
Save yourself the annoyance by following the next steps.
- Open the Visual Basic Editor (in Outlook, press ALT+F11).
- On the left-hand side of the screen, expand the ‘Project1’ (go into ‘Microsoft Office Outlook Objects’ -> ‘ThisOutlookSession’).
- Double click on ‘ThisOutlookSession’
- 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.
The code has been tested on Outlook 2003 and 2007.
Credits: this code is extracted from a more sophisticated script .
Extra info: if you want to go ‘all the way’, you can also self-sign your macro so that Outlook does not present you with a warning every time you start the program up.