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
- 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.
- Click Insert and Module to open a new module window.
- 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
- Paste that code into the VBA Module window with the Ctrl + V hotkey.
- 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.
- Next, save the new script.
- Close the VBA Module window.
2. Set up an Outlook rule for the VBA script
- To set up an Outlook rule for the download attachment script, click the Rules button.
- Select Manage Rules & Alerts to open the Rules and Alerts window.
- Click the New Rule button.
- 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.
- Select the run a script check box.
- Click a script to open the Select Script window.
- Select the download attachment script in the Select Script window, and click the OK button.
- Select the Next option.
- Enter a title for the rule in the text box on the last Rules Wizard dialog box.
- Select the Turn on this rule option.
- 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>.
- 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.
For any more questions or suggestions, don’t hesitate to reach for the comments section below.
RELATED ARTICLES TO CHECK OUT:
- How to convert Outlook mail to Thunderbird or Yahoo
- How to convert a Microsoft Outlook PST file to OST easily
- How to Add multiple accounts to Outlook [QUICK GUIDE]