Outlook VBA way to differentiate between attachments and embedded images?

Tarver

Board Regular
Joined
Nov 15, 2012
Messages
109
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm trying to prevent myself from accidentally sending a file to someone outside of my organization's domain. (We've all hit the "reply all" button and sent something to someone we didn't know was in the email chain, right?) I've got some code I found online, but it doesn't make a determination between a file that's attached to the email and images that are embedded within the email.

So, for instance, because my email signature includes the company logo, every single email I send is stopped by the code
Code:
If Item.Attachments.Count > 0 Then

I could raise this to be >1 to account for my signature, but then any email I send without a signature could include an attachment of sensitive information, and the code wouldn't stop it from going out.

Is there a way to look for ONLY attached files, rather than ALL files that would normally be included in the body of an email?

Thanks!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Why not loop through the attachments, checking them as you go?
Code:
For Each att In Item.Attachments
    ' check att
Next att
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,272
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top