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.
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.
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:
Code:
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
The code has been tested on Outlook 2003 and 2007.