Solved

Can Outlook warn me before I send an email without an attachment?

Posted on 2006-07-20
3
1,418 Views
Last Modified: 2008-01-09
Dear Experts,

A disconcerting proportion of the time, I intend to send a message with an attachment, and yet I forget to actually
attach the file.  Much embarassment ensues :)

Is there a way to make Outlook do the following after I click the send button but before it actually gets sent:

1) Search for the string "attach" in the body of the message
2) If it finds that string, check to see that there is >0 attachments associated with the message
3) If there are zero attachments, warn me, and give the opportunity to stop the send

Can this be done?

Regards,

Patrick
0
Comment
Question by:Patrick Matthews
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 17147894
Happy Thursday, Patrick.

Yes, this can be done easily.  Here's what I use on my computer.  It checks for more strings than you mentioned .  You can remove the ones you don't want.  This code goes in ThisOutlookSession.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim arrWords As Variant, _
        strWord As Variant, _
        intResponse As Integer
    If Item.Class = olMail Then
        If Item.Sent = False Then
            arrWords = Array("enclosed", "attach","attached", "attachment")
            For Each strWord In arrWords
                If InStr(1, LCase(Item.Body), strWord) > 0 Then
                    If Item.Attachments.Count = 0 Then
                        intResponse = MsgBox("Did you forget to attach something?", vbYesNo + vbExclamation, "Attachment Check")
                        If intResponse = vbYes Then
                            Cancel = True
                        End If
                    End If
                    Exit For
                End If
            Next
        End If
    End If
End Sub



Cheers!
0
 
LVL 92

Author Comment

by:Patrick Matthews
ID: 17147968
Awesome!

Thank you very much, David :)

Patrick
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17148208
Your welcome, Patrick.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now