• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Check for missing attachments before sending a message

Slipstick Systems

› Outlook › Email › Check for missing attachments before sending a message

Last reviewed on December 1, 2017     62 Comments

Applies to: Outlook 2007, Outlook 2010

While a warning dialog is built into Outlook 2013 and above, you need to use VBA or an add-in with older versions of Outlook to check for keywords which may indicate you planned to include an attachment.
attachment reminder dialog in Outlook 2013

For warnings before sending a message with a blank subject, see the following articles:
Outlook 2007 and earlier Outlook 2010 and above

Outlook 2013 and above

An attachment warning feature is built into Outlook, beginning with Outlook 2013. If you don't want the warning, you can disable it by checking the "Do not show... " box in the warning.

If you change your mind, you can turn it back on in File, Options, Mail. The option to warn before sending a message that may be missing an attachment is in the Send Messages section about halfway down.

Outlook 2013's missing attachment option

VBA for Outlook 2010 and older

When you use Outlook 2010 and older, you need to use VBA or an add-in to warn about missing attachments.

The following macro needs to go in ThisOutlookSession and runs when the message is sent. If it finds the word "attach" in the message body, it triggers a warning dialog.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
        If Item.Attachments.Count = 0 Then
          answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
          If answer = vbNo Then Cancel = True
        End If
   End If
End Sub

Skip attachments in signatures

If you have an image in your signature, it will be detected as a an attachment and pass the Attachment check. To avoid that problem, check for attachment size. You'll need to loop through all attachments on the message and skip over the attachments that are smaller than a specific size. In my example, I'm looking for attachments over approximately 5 KB. If your signature has larger images, you'll need to increase the attachment size you check for.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
 If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
    If Item.Attachments.Count = 0 Then
        answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
    If answer = vbNo Then Cancel = True 
 End If

If Item.Attachments.Count > 0 Then
 For Each oAtt In Item.Attachments
    Debug.Print oAtt.Size
      If oAtt.Size < 5200 Then
        GoTo NextAtt
       
       Else
       answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
       If answer = vbNo Then Cancel = True
    End If
NextAtt:
 Next oAtt
 
 End If
End If
End Sub

Check for attachment name in subject

We had an Outlook user sending wrong file (attachment) to wrong recipients. We created a template for each client that contains a unique Client number and the attachment filename always starts with the unique client number. By validating the subject line with the file name we can warn user the client number doesn't match so they can check before sending out the email.

This code checks the first 15 characters of the attachment filename against the first 15 characters of the subject.

By changing the If statement you could check other values.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objAttachments As Outlook.Attachments
Dim strAttachment As String

Set objAttachments = Item.Attachments

strAttachment = objAttachments.Item(1).FileName

 If Left(strAttachment, 15) = Left(Item.Subject, 15) Then
 Else
      prompt$ = "You sending  " & strAttachment & ". Are you sure you want to send it?"
       If MsgBox(prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Sending Account") = vbNo Then
         Cancel = True
       End If
 End If

End Sub

Combine Two ItemSend macros

If you want to use two ItemSend macros to check outgoing mail, you need to combine them into one. This example combines the "blank subject warning" and missing attachment macros.

We could do a better job of merging them into one macro, with one dialog box, but it will work simply by combing the two like this.

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

   If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
        If Item.Attachments.Count = 0 Then
          answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
          If answer = vbNo Then Cancel = True
        End If
   End If

End Sub

 

Tools

Attachment Forget-Me-Not

The Attachment Forget-Me-Not Outlook add-in scans each outgoing email for phrases like "see attached" or "draft version". It then asks you if you meant to attach a file before sending the email, giving you a chance to insert the attachment. Version 4.0 is being released that works with both Outlook 2010 32-bit and Outlook 2010 64-bit.

Outgoing Email Checker

Outgoing Email Checker for Microsoft Outlook will check your emails before sending them for conditions you specify in the rules. You can create a rule using a template or start from scratch. This reminder add-in will help you avoid most common emailing mistakes: Get a reminder to add attachment to your email in Outlook, Avoid sending large messages, Enable Reply All warning and make sure you use the correct account, Remember to fill CC or BCC lines when necessary

SendGuard 4Outlook

Send Guard will detect and prompt you whenever you make any of these mistakes and more: forget to send an attachment you promised in a message, Reply-to-All or forget to Reply-to-All, send emails using the wrong email account, send emails with blank or incorrect subjects, said something you oh-so-knew-better than to say.

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To use the macro code in ThisOutlookSession:

  1. Expand Project1 and double click on ThisOutlookSession.
  2. Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)

More information as well as screenshots are at How to use the VBA Editor

Check for missing attachments before sending a message was last modified: December 1st, 2017 by Diane Poremsky

Related Posts:

  • "Is there any way I can set up a warning (or possibly limit) on the si
    Check Message Size Before Sending
  • A macro that checks the number of recipients on an outgoing Outlook me
    Check messages you send for number of recipients
  • Use VBA to check Outlook's outgoing messages for attachments and cance
    Do you want to send an attachment?
  • Macro to Warn Before Sending a Message with a Blank Subject

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
62 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

DanJ
November 6, 2017 7:26 pm

Your VBA works great. I would also like to test for any links. Instead of attaching documents I link many documents to coworkers. I tried to modify the code to find "linked" and to see if any documents a linked. But I have not had luck. Can you Help?

0
0
Reply
Diane Poremsky
Author
Reply to  DanJ
November 6, 2017 11:56 pm

you can search for the word linked and https addresses. Not tested, but something like this:
If InStr(1, Item.Body, "linked", vbTextCompare) > 0 Then
If InStr(1, Item.Body, "http", vbTextCompare) = 0 Then
' link is missing

Only issue is that it will find http is signature links.

0
0
Reply
DanJ
Reply to  Diane Poremsky
November 7, 2017 6:37 pm

Thanks for your speedy reply. Interestingly "Linked" works for finding a name in the item.body. I have a link to my email address in my signature, so if I use: If InStr(1, Item.Body, "link", vbTextCompare)>0 , it will always be true even if the word "link" is nowhere in the item.body. That might be a good hint of how to find links although I have not had success yet working with properties. If I take the link out of my signature, then it will look for the word in the item. body. Although I would rather it use "link", I am okay with using "linked" which seems to work.
What does not seem to work is the "http" part. It seems to not find it in a link. I also often insert Excel spreadsheets, Word documents, and PDF files as hyperlinks. I was willing to add ".xls", ".doc", and "pdf" but it will not find those in the links either.
I link more things to my coworkers than I attach because my files often are huge. Please continue to help as I cannot find anywhere else about checking for links in an email. Thanks.

0
0
Reply
Diane Poremsky
Author
Reply to  DanJ
November 7, 2017 10:27 pm

Oops... use item.htmlbody instead of item.body to see the underlying html code when you use a friendly hyperlink in the message.

0
0
Reply
DanJ
Reply to  Diane Poremsky
November 8, 2017 4:42 pm

I found the answer to the problem:
Hyperlinked documents in Item.Body always start with "HYPERLINK" so you can search for that. The web links, you can search for "http" like you suggested. The below will work for the link then. It changes the HYPERLINK to blank so that it will look only for the word link, and then it will look for hyperlinks for a message box:

If InStr(1, Replace(Item.Body, "HYPERLINK", "", , , vbBinaryCompare), "link", vbTextCompare) > 0 Then
If InStr(1, Item.Body, "http", vbTextCompare) + InStr(1, Item.Body, "HYPERLINK ""file:///", vbTextCompare) = 0 Then
vbMBR = MsgBox("There is no link, send anyway?", vbYesNo)
Cancel = vbMBR = vbNo
End If
End If

0
0
Reply
JHeff
April 5, 2017 7:14 am

The code initially worked but I haven't been able to get it working again since.
I'm working on outlook 2007

I tried changing the macro security setting to 'Warnings for all Macros' and No security check for macros' and it still doesn't work.

This is the code I am using is copied from above, is there something I am missing?

Thanks for your help!!

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
If Item.Attachments.Count = 0 Then
answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
If answer = vbNo Then Cancel = True
End If

If Item.Attachments.Count > 0 Then
For Each oAtt In Item.Attachments
Debug.Print oAtt.Size
If oAtt.Size < 5200 Then
GoTo NextAtt

Else
answer = MsgBox("There's no attachment, send anyway?", vbYesNo)
If answer = vbNo Then Cancel = True
End If
NextAtt:
Next oAtt

End If
End If
End Sub

0
0
Reply
Diane Poremsky
Author
Reply to  JHeff
April 5, 2017 12:08 pm

i'm assuming if it worked once, that you have it in thisoutlooksession.
Add msgbox "working" to the top, before the IF lines - does the message box come up when you send?

0
0
Reply
Carl
April 5, 2017 1:41 am

How could this reminder be invoked for Office 2013+, from code, eg from Dephi or C#.Net?

0
0
Reply
Diane Poremsky
Author
Reply to  Carl
April 5, 2017 8:13 am

Are you creating an addin? To use either, you'll need to create an addin.

0
0
Reply
Jins
March 24, 2017 3:42 am

This is not working for me though I have changed the Macro settings as suggested.

0
0
Reply
Diane Poremsky
Author
Reply to  Jins
March 24, 2017 8:52 am

Did you put the macro in ThisOutlookSession? (Automatic macros need to be in thisoutlooksession).
Did you restart outlook? it's not need for the ItemSend macro, unless you changes the security settings after adding the macro.

After this line:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
add this:
msgbox "ItemSend macro running"

and send a message. Does the message box come up?

0
0
Reply
Donna
March 21, 2017 11:41 am

Hi, I used the code shown below (as per your example) to check for attachments. I made only one change and that was the Attachments Count from 0 to 1 (because our emails always contain our logo which would, presumably, be detected as an attachment). It works - but it works on ALL emails when I press the Send button regardless of whether the word "attach" is in the body of the email or not!

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If InStr(1, Item.Body, "attach", vbTextCompare) > 0 Then
If Item.Attachments.Count = 1 Then
answer = MsgBox("There is no attachment. Send anyway?", vbYesNo)
If answer = vbNo Then Cancel = True
End If
End If
End Sub

Any idea where I am going wrong?

Thanks in advance,

0
0
Reply
Diane Poremsky
Author
Reply to  Donna
March 23, 2017 4:58 pm

it looks good...and is working here. Is there anything in the signature that contains 'attach'? It will pick up 'attach' anywhere in the message or url - if there is a word that ends in attach, it would trigger on it.
Did you test it with a sample signature that only has the logo in it?

0
0
Reply
Ross
July 26, 2016 7:43 am

I cannot get this to work at all when i have a Signature with image. Any ideas ?

0
0
Reply
Diane Poremsky
Author
Reply to  Ross
October 18, 2016 12:23 am

you'll need to use an if statement to ignore attachments under a certain size.

0
0
Reply
Jay
Reply to  Diane Poremsky
December 2, 2016 11:01 am

Hi, but doesn't it ignore the small attachments and when it finally finds a bigger one then it shows the programmed message? I found that this macro works exactly in the opposite way. Any thoughts on that?

0
0
Reply
sam
May 9, 2016 4:01 pm

I don't understand. I have copied & pasted the text for the check missing attachments into my "ThisOutlookSession" VBA window, and it worked at first but now has stopped working. Is there a chance I have messed up a setting, or what?

0
0
Reply
Diane Poremsky
Author
Reply to  sam
May 9, 2016 11:55 pm

did you change the macro security setting? that is the usual reason why macros don't work after you restart outlook.

0
0
Reply
Sangal
Reply to  sam
July 12, 2016 7:59 pm

I am having the same problem. The attachment notification worked at first but nothing is working now after restarting outlook. My macro security settings are set at 'Notification for digitally signed macros, all other macros disabled'. Thanks is advance.

0
0
Reply
Eissa
March 19, 2016 1:22 am

This is very useful.

0
0
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 29

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

:wpds_smile::wpds_grin::wpds_wink::wpds_mrgreen::wpds_neutral::wpds_twisted::wpds_arrow::wpds_shock::wpds_unamused::wpds_cool::wpds_evil::wpds_oops::wpds_razz::wpds_roll::wpds_cry::wpds_eek::wpds_lol::wpds_mad::wpds_sad::wpds_exclamation::wpds_question::wpds_idea::wpds_hmm::wpds_beg::wpds_whew::wpds_chuckle::wpds_silly::wpds_envy::wpds_shutmouth:
wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment