How to Set Outlook Rule Save Email Attachments to a Folder

A VBA script is usually the quickest solution

by Matthew Adams
Matthew Adams
Matthew Adams
Windows & Software Expert
Matthew is a freelancer who has produced a variety of articles on various topics related to technology. His main focus is the Windows OS and all the things... read more
Reviewed by Alex Serban
Alex Serban
Alex Serban
Windows Server & Networking Expert
After moving away from the corporate work-style, Alex has found rewards in a lifestyle of constant analysis, team coordination and pestering his colleagues. Holding an MCSA Windows Server... read more
Affiliate Disclosure
  • Setting an Outlook rule to save all attachments automatically will greatly increase your productivity.
  • In order to do that, you can use the code provided below to create a VBA script.
  • You may also set a rule in Outlook to download attachments.
how to set outlook rule to save attachment
Tired of email issues? Get this email client and get rid of them!Your email client/account give you headaches? We offer you the perfect email client that will centralize all your email accounts and will let you access your important data without any errors. You can do now:
  • Manage ALL your emails in a single inbox
  • Easy to integrate popular apps (Facebook, Todoist, LinkedIn, Dropbox, etc.)
  • Access all your contact from a single environment
  • Get rid of errors and lost email data

Email made easy & beautiful

XINSTALL BY CLICKING THE DOWNLOAD FILE
Try Outbyte Driver Updater to resolve driver issues entirely: This software will simplify the process by both searching and updating your drivers to prevent various malfunctions and enhance your PC stability. Check all your drivers now in 3 easy steps:
  1. Download Outbyte Driver Updater.
  2. Launch it on your PC to find all the problematic drivers.
  3. Afterward, Click Update & Apply Selected to get the latest driver versions.
  • OutByte Driver Updater has been downloaded by 0 readers this month.

Outlook users often need to download files attached to their emails. And there’s a way you can automatically save email attachments to a folder in Outlook using by setting up a rule.

The ability to automatically download all email attachments of newly received emails in Outlook and save them to folders is handy. So, let’s find out how you can do that with a VBA Script.

How can I set up an Outlook rule to automatically save email attachments to a folder?

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 or Alt + Fn + F11 hotkey, depending on whether the function key is locked or unlocked, which opens the Microsoft Visual Basic window.
  2. Click Insert and Module to open a new module window.insert
  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.paste
  5. Note that the C:\Users\DT168\Documents\outlook-attachments path in that script is an example. Replace it with the full path of the folder to download the attachments.
  6. Next, save the new script.
  7. Close the VBA Module window.

For those wondering how to automatically download/save attachments from Outlook to a certain folder VBA, you now know the script. The next step is to set a rule for it.

2. Set up an Outlook rule for the VBA script

Note icon NOTE
The option to Run a script has been discontinued in the recent versions of Outlook. You can get it back by making minor changes to the Registry, as illustrated in the first few steps below.
  1. Press Windows + R to open Run, type regedit, and then hit Enter.registry
  2. Click Yes in the UAC prompt.
  3. Paste the following path ((might be different for other versions of Outlook) in the address bar and hit Enter:Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Securitypath
  4. Right-click on the empty portion, hover the cursor over New, choose DWORD (32-bit) Value, and then name it EnableUnsafeClientMailRules.dword (32-bit) value
  5. Double-click on the newly created DWORD, enter 1 under Value Data, and then click OK to save the changes.value data
  6. Now, launch Outlook.
  7. To set up a rule to download attachments, click the Rules button, and then select Manage Rules & Alerts.manage rules and alerts
  8. Click the New Rule button.new rule
  9. Select the Apply rule on message I receive option and click Next. Some users might need to select a Check messages when they arrive option in older Outlook versions.apply rule
  10. Choose the which has an attachment option, and then click Next.rule
  11. Select the Run a script check box, and then under Step 2, click on a script link.run a script
  12. Select the download attachment script you pasted earlier, and then click the OK button.script
  13. Click Next.
  14. Enter a title for the rule in the text box, and select the Turn on this rule option.
  15. 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>.
  16. Click the Finish button.

Once done with the rule, Outlook will automatically download attachments to the folder path in the script. Then you won’t need to download the attachments manually. Open the folder path specified in the macro in File Explorer to look through the attachments.

If you are looking for alternatives, here are the best email clients for Microsoft 365.

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

This article covers:Topics: