Friday 2 May 2008

MSOutlook Alert

How to make outlook alert before sending mail with no subject

Alerting can be made only as a hotfix by writing some macro

No option available on Outlook to enable this feature

Steps:-

1) Open outlook

2) Press Alt+F11 (VB Editor will be opened)

3) Expand the "Project1"

4) Expand "Microsoft Office Outlook"

5) double click on "ThisOutlookSession"

6) Now paste the following code


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


7) Save and close VB Editor

8) Close Outlook and when asked to save the macro in "ThisOutlookSession" select "yes".

9) Now open outlook and when asked to enable macros select "Yes"

Problem solved