Setup an Outlook rule to download attachments to a folder
Outlook users are often required to download attachments to their email. So it will be helpful if Outlook automatically downloads all the email attachments from the newly received email. You can configure Outlook to fix it with a VBA script and a rule for it.
How to set up an Outlook rule for downloading attachments :-
Set up the VBA script(visual basic script):-
First, set up a VBA script that downloads attachments to a specified folder. Press the Alt + F11 hotkey, which opens the Microsoft Visual Basic window.
Click on Insert and Module to open a new module window.
- Copy this VBA code with the key combination Ctrl + C: 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 - Paste that code into the VBA Module window with the Ctrl + V hotkey.
Note that the path “C: \ Users \ DT168 \ Documents \ outlook-attachments” in that script is an example. Replace “C: \ Users \ DT168 \ Documents \ outlook-attachments” with the full folder path to download the attachments. - Then save the new script.
- Close the VBA module window.
Set up an Outlook rule for the VBA script (visual basic script) :–
- To configure an Outlook rule for the attachment download script, click the Rules button
- Select Manage Rules and Alerts to open the Rules and Alerts window.
- Click on the New Rule button.
- Choose Apply rule to Receive message option and click Next to open the window shown below. Some users may need to select verification messages when the option appears in earlier versions of Outlook.
- Run the script script box.
- Click Script to open the Choose Script window.
- Select the script from the download attachment in the Select Script window and click the OK button.
- Choose the next option.
- In the Final Rules Wizard dialog box, enter a title for the rule in the text box.
- Select the option to activate this rule.
- If you wish, you can also choose to run this rule now on messages already in the “Inbox” option. The rule description box should say the following: After applying this rule the message reaches this computer just run <macro title>.
- Click on the Finish button.