Search This Blog

Wednesday, July 21, 2010

OutLook Attachment reminder


Most of the time I use to forget to attach the files after mentioning file has been attached to this email so to avoid this I wrote a small piece of code(VBA) which can check for attachment as well as for subject line is empty


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject, strBody As String
strSubject = Item.Subject
strBody = Item.Body

If (InStr(LCase(strBody), "attach") > 0 And (Item.Attachments.Count) = 0) Then
Prompt$ = "You have not attached document,But specified in the Mail, Still you want to send ?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
Exit Sub
End If
End If
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


Press Alt+F11 from your outlook window and paste the code on the code window
Press debug -> compile
Save and close
  • Go to C:\Program Files\Microsoft Office\Office10 or C:\Program Files\Microsoft Office\Office folder in your computer 
  • Open "SELFCERT.EXE" Enter name "sundar" and click ok
  • Restart your Outlook
  • Then press Alt+F11 again from the tools menu select digital signature select the file "sundar"
  • Click Ok and restart Outlook
That It .

No comments:

Post a Comment