Solved

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

Posted on 2006-07-20
3
1,408 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
Comment Utility
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
Comment Utility
Awesome!

Thank you very much, David :)

Patrick
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Your welcome, Patrick.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

8 Experts available now in Live!

Get 1:1 Help Now