How to auto forward attachments only based on specific criteria in Outlook?

Normally, when forwarding an email, the original message body and attachments are included as well. But, sometimes, you just need to forward only attachments without the original message based on criteria to a specific person. How could you solve this job in Outlook?

Forward only attachments based on specific criteria to a person automatically with VBA code


Forward only attachments based on specific criteria to a person automatically with VBA code

For example, when receiving an email which subject contains the text “kto feature”, all attachments of this email will be forwarded to the specific person automatically without message body. The following steps can help you, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, double click ThisOutlookSession from the Project1(VbaProject.OTM) pane to open the mode, and then copy and paste the following code into the blank module.

VBA code: Auto forward email without message body but just include the attachments:

Public WithEvents ReceivedItems As Outlook.Items
Private Sub Application_Startup()
    Set ReceivedItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub ReceivedItems_ItemAdd(ByVal Item As Object)
    Dim xForwardMail As Outlook.MailItem
    Dim xEmail As MailItem
    On Error Resume Next
    If Item.Class <> olMail Then Exit Sub
    Set xEmail = Item
    If InStrRev(UCase(xEmail.Subject), UCase("kto feature")) = 0 Then Exit Sub  'change subject text to your need
    If xEmail.Attachments.Count = 0 Then Exit Sub
    Set xForwardMail = xEmail.Forward
    With xForwardMail
        .HTMLBody = ""
        With .Recipients
            .Add "skyyang@addin88.com"    'change address to your own
            .ResolveAll
        End With
        .Send
    End With
End Sub

Note: In the above code, you should change the subject text and recipient address to your own.

doc auto forward attachments only 1

3. Then save the code, and restart the Outlook to take the code effect.

4. From now on, each time when a new email contains the specific subject text arrives in your mailbox, Outlook will auto forward its attachments without message body to the desired person.

Note: This code is only available to the default account.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 

 

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.