Skip to main content

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

Author: Xiaoyang Last Modified: 2018-08-02

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 ""    'change address to your own
        End With
    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.

Best Office Productivity Tools

Breaking News: Kutools for Outlook Launches Free Version!

Experience the all-new Kutools for Outlook FREE version with 70+ incredible features, yours to use FOREVER! Click to download now!

🤖 Kutools AI : Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Auto Reply (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Instantly unlock Kutools for Outlook with a single click—permanently free. Don't wait, download now and boost your efficiency!

kutools for outlook features1 kutools for outlook features2




Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This is great, but if someone replies to the chain of the email with an attachment it will auto-forward that attachment as well. Is there a way to avoid this? Thanks
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations