How to set an Outlook rule to download attachments to a folder

Matthew Adams
by Matthew Adams
Windows & Software Expert
0 Comments
Download PDF
Affiliate Disclosure

Outlook rule to download attachments to a folder

Outlook users often need to download files attached to their emails. So, it would be handy if Outlook automatically downloaded all email attachments of newly received emails. You can configure Outlook to do exactly that with a VBA script and a rule for it.

How can I set up an Outlook rule for downloading attachments?

1. Set up the VBA script

  1. First, set up a VBA script that downloads the attachments to a specified folder. Press the Alt + F11 hotkey, which opens the Microsoft Visual Basic window.
  2. Click Insert and Module to open a new module window.VBA window outlook rule download attachments to folder
  3. Copy this VBA code with the Ctrl + C hotkey: Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = “C:\Users\DT168\Documents\outlook-attachments”
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  4. Paste that code into the VBA Module window with the Ctrl + V hotkey.
  5. Note that the ‘C:\Users\DT168\Documents\outlook-attachments’ path in that script is an example. Replace ‘C:\Users\DT168\Documents\outlook-attachments’ with the full path of the folder to download the attachments to.
  6. Next, save the new script.
  7. Close the VBA Module window.

2. Set up an Outlook rule for the VBA script

  1. To set up an Outlook rule for the download attachment script, click the Rules button.The Rules button outlook rule download attachments to folder
  2. Select Manage Rules & Alerts to open the Rules and Alerts window.
  3. Click the New Rule button.
  4. Select the Apply rule on message I receive option and click Next to open the window shown directly below. Some users might need to select a Check messages when they arrive option in older Outlook versions.Rules Wizard outlook rule download attachments to folder
  5. Select the run a script check box.
  6. Click a script to open the Select Script window.
  7. Select the download attachment script in the Select Script window, and click the OK button.
  8. Select the Next option.
  9. Enter a title for the rule in the text box on the last Rules Wizard dialog box.
  10. Select the Turn on this rule option.
  11. You can also select the Run this rule now on messages already in ‘Inbox’ option if preferred. The rule description box should read as follows: Apply this rule after the message arrives on this computer only run <macro title>.
  12. Click the Finish button.

Thereafter, Outlook will automatically download attachments to the folder path included in the script. Then you won’t need to manually download the attachments. Open the folder path specified in the macro in File Explorer to have a look through the attachments.

Ad

For any more questions or suggestions, don’t hesitate to reach for the comments section below.

RELATED ARTICLES TO CHECK OUT: 

Ad