Sunday, April 12, 2009

How to Prevent Sending Mails without Subject in MS outlook 2003/07

It's quite often some time we send mail without mentioning subject line, that creates bad impression some times, to solve this problem I found this solution , thought of sharing with you guys

Steps :

  • Open MS Outlook 2003 /2007
  • Press Alt+F11, This will open the Macro Visual Basic Editor
  • On the Left Pane, you can see "Microsoft Outlook Objects" expand that
  • Look for the menu "ThisOutLookSession"
  • Click on the menu "ThisOutLookSession" and copy paste the below code
    Code :
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 
Dim strSubject As String
strSubject = Item.Subject
If Len(strSubject) = 0 Then
Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "No Subject Warning") = vbNo Then
Cancel = True
End If
End If
End Sub




  • Save the  and close Visual Basic Editor


  • Then in Outlook , click Tools > Macros > Security > In the Security Level Tab > Select the option MEDIUM > OK (in outllook 2003)


  • In outlook 2007 click Tools > Macros > Security > select warn for all marcros


  • Now Restart the Outlook, a dialog box pops up to Disable / Enable the macros; select as Enable Macros (this option will pops up when ever you restart outlook.)





So when ever you send a email without subject a Message Box will popout saying "Subject is Empty. Are you sure you want to send the Mail?" ,

if you want to proceed you can click Yes else No

Thus our problem is solved.

2 comments:

Unknown said...

Really good script.

Alex said...

I quite frequently work with outlook messages. And I will say an one story as an advice to the future. Couple weeks ago I lost my emails. But I wasn't lost and entered the Inet. I noticed there - repair ost file. It resolved my issue and moreover showed me how it could convert *.ost to a *.pst file, that could be easily opened by any mail client.