Save attachments from e-mail to a folder with MS Outlook VBA
I’m writting this article because I used this macro several times, so I’d like to help others if I can.
I’ll teach how to use VBA scripts in Microsoft Outlook to run a macro that can save any attachments from email to a folder.
You can find the attachments in my GitHub repository.
For VBA scripts in Microsoft Outlook to work, you must check the following points below:
- Using a mailbox for any user that has access to the email
- Check if the rules on Outlook can run a script. If not, run the regedit file to add the option
Run a Script
- Necessary to enable All Macros from Trust Settings on MS Outlook
- Create a rule to execute the VBA macro on the e-mail received
If your Microsoft Outlook does not have the
Run a Script option in the rule, then you must add a value within a parameter in Regedit or just execute the regedit file.
But it is easier if you download the file with the extension
.reg and run it, according to the version of your Microsoft Outlook. After installation, restart Microsoft Outlook. That way, the
Run a Script option will appear normally.
- Download the regedit file according to the version of your Microsoft Outlook
- Execute the regedit file to add value in the right path
- Restart your Microsoft Outlook
In order to work, you need to copy and paste the content of the file
ThisOutlookSession.vb into MS Outlook.
In order to create your rule on Outlook, you can import the rule called “SaveAtchFromEmail.rwz” to your MS Outlook rules and change the email subject that the file will be received as the image below.
And that’s it! Now you can use a VBA script to save a file in any folder!
Please, feel free to contact me on Linkedin if hou have any questions.