logandiana
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 107
I have some rules in Outlook that forward emails with attachments.
The problem is that the Outlook rule can't seem to figure out the difference between an actual attachment, like an xlsx, pdf, docx, etc., versus something like a small png picture that is embedded in someone's signature panel.
I need the rule to just forward the emails that have that paperclip attachment icon in Outlook. On the receiving end they are getting many emails without any documents attached, but come to find out that there is some small .jpg or png somewhere in the email.
First off is there anyway to specify this in the rules? to only forward those with 'actual' attachments? I didn't find any.
So I though maybe I could use Outlook VBA to remove any and all attachments that have a certain criteria.
I sent an email to myself packed with several different types of attachments to see if I could forward the email, but only include xlsx attachments, but the code keeps removing everything.
Can someone look at it? I feel like I am close.
The problem is that the Outlook rule can't seem to figure out the difference between an actual attachment, like an xlsx, pdf, docx, etc., versus something like a small png picture that is embedded in someone's signature panel.
I need the rule to just forward the emails that have that paperclip attachment icon in Outlook. On the receiving end they are getting many emails without any documents attached, but come to find out that there is some small .jpg or png somewhere in the email.
First off is there anyway to specify this in the rules? to only forward those with 'actual' attachments? I didn't find any.
So I though maybe I could use Outlook VBA to remove any and all attachments that have a certain criteria.
I sent an email to myself packed with several different types of attachments to see if I could forward the email, but only include xlsx attachments, but the code keeps removing everything.
Can someone look at it? I feel like I am close.
VBA Code:
Sub ChangeSubjectForwardtestscript(myItem As Outlook.MailItem)
Dim myInspector As Outlook.Inspector
Dim myAttachments As Outlook.Attachments
Dim LA As Long
Dim i As Integer
On Error Resume Next
If myItem.UnRead = True Then
Set myInspector = Application.ActiveInspector
Set myItem = myInspector.CurrentItem.Forward
Set myAttachments = myItem.Attachments
LA = myAttachments.Count
For i = LA To 1 Step -1
If Right(myAttachments.myItem(i).DisplayName, 4) <> "xlsx" Then
myAttachments.Remove i
End If
Next i
LA = myAttachments.Count
myItem.Recipients.Add "email@email.com"
myItem.Send
myItem.UnRead = False
End If
End Sub