Email : Forgot to mention a subject line or forgot an attachment?
Tuesday, February 5, 2008, 01:15 PM -
Tips and Tricks
Quite often while sending an email I forget to attach the file which I claim I have attached. It would be nice if Outlook was smart enough to find it out and gave me a warning message while I press the send button.
Below are the steps that will make your MS Outlook pop up a warning if you forgot to attach the file. It works by searching the existence of either of the words "attach" or "enclose" and checking if there is indeed any attachment. False positives are obvious, but its OK for me.
I never send an email without a subject, but still the steps below ensure that you would get a pop up warning, if you attempt to send am email with an empty subject line.
Below are the steps what I did on my MS-Outlook a few minutes back.(Somebody fwded me an email with the "subject-line-missing" script. I searched the net to find out the "attachment-missing-code". I got the code, it did not work, twisted it a bit and got both of them working together). Thought I would share it here:
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.
5. Copy and Paste the following code in the right pane. (Code Pane) and save it
Function SearchForAttachWords(ByVal s As String) As Boolean
Dim v As Variant
For Each v In Array("attach", "enclose")
If InStr(1, s, v, vbTextCompare) <> 0 Then
SearchForAttachWords = True
Exit Function
End If
Next
End Function
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$ = "Shuva!!!!! Are you sure you want to send this email without a subject?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
If Item.Attachments.Count > 0 Then Exit Sub
If Not SearchForAttachWords(Item.Subject & ":" & Item.Body) Then Exit Sub
Prompt$ = "Shuva!!!!! Are you sure you want to send this email without an attachment?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for attachment") = vbNo Then
Cancel = True
End If
End Sub
Happy Emailing.//