We often feel horrible when we send email messages to our bosses without any subject line. Here is a simple way to avoid such mistakes...
Steps: -
1. Open your Outlook,
2. Press Alt+F11. This opens the Visual Basic Editor and then Press Ctrl+R which in turn open Project-Project 1 (left side)
3. On the Left Pane, one can see "Microsoft Outlook Objects" or "Project1", expand this. Now one can see the "ThisOutLookSession".
4. Double click on "ThisOutLookSession". It will open up a Code Pane on the right hand side.
5. 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
6. Save the Project and exit.
Now whenever you try to send a mail without subject, a pop-up is raised to remind you of the blank subject.
6 comments:
I tried this but it is not working Microsoft outlook is not prompting and it sends without any alerts. please help. My e-mail address is amit.s.patni@gmail.com
You need to save the project after editing. Don't miss step no. 6.
Even after saving the project it is not working. Please help.
thanks it work efficiently just separate by ENTER key between Code
Hi yesterday I wrote this code and it work fine but today is not work Why I don't know. Please help me.
Hi Mohammed,
Have you saved the project after making the code changes as given above?
Step 6. from the above code is very important. If you save the project then the code should work fine even if you reboot your machine or restart outlook application.
-Sandeep
Post a Comment