Sometimes when we send mails, we may forget to mention the subject in the mail. The blank subject line must be avoided as much as possible to follow email etiquette. Especially when you write official mails, Subject should be mentioned as it is one of the important parts of a mail. Using a small tip, you can set a reminder or notification which pops up whenever you leave the subject line empty. The procedure is as follows..
- Open your Microsoft Outlook
- Press Alt+F11. This opens the Visual Basic Editor and open Project-Project 1 (left side). If this doesn’t open Project-Project 1 then press then Press Ctrl+R.
- On the Left Pane, one can see “Microsoft Outlook Objects” or “Project1”, expand this. Now one can see the “ThisOutLookSession”.
- Double click on “ThisOutLookSession”. It will open up a Code Pane on the right hand side.
- Copy and Paste the following code in the right pane (Code Pane) and save it
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
Now whenever you try to send a mail without subject, a pop-up is raised to remind you of the blank subject. This is a very useful precautionary measure to avoid sending mails without the subject line.
at first this code is working fine, but when i close my outlook and reopen it again to send an email, it still sends email without a subject? What could have been wrong?
I was recommended this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re wonderful! Thanks!
I’m getting a compile error also on this portion of the code
Prompt$ = “Subject is Empty. Are you sure you want to send the Mail?”
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, “Check for Subject”) = vbNo Then
Use the below code
Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMessage As String
Dim lngRes As Long
If Item.Subject = “” Then
Cancel = True
strMessage = “Please fill in the subject before sending.”
MsgBox strMessage, _
vbExclamation + vbSystemModal, “Missing Subject”
Item.Display
End If
End Sub
I get a compile error: syntax error message using Outlook 2003