Note: The other languages of the website are Google-translated. Back to English
Log in  \/ 
x
or
x
Register  \/ 
x

or

How to automatically download/save attachments from Outlook to a certain folder?

Generally speaking, you can save all attachments of one email with clicking Attachments > Save All Attachments in Outlook. But, if you need to save all attachments from all received emails and receiving emails, any ideal? This article will introduce two solutions to automatically download attachments from Outlook to a certain folder.


Automatically download Outlook attachments to folder with VBA and rule

This method will introduce a VBA script, and run this scrip with a rule to automatically download and save Outlook attachments to a certain folder. Please do as follows:

1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and then paste below VBA script into the new opening Module window.

VBA: Auto Save Outlook Attachments into a certain folder

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

Note: Please find out sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\", and replace the destination folder’s path as you need.

3. Save the VBA Script and close the Microsoft Visual Basic for Applications window.

4. Go to the Mail view, and click Home > Rules > Manage Rules & Alerts. See screenshot:

5. In the opening Rules and Alerts dialog box, please click the New Rule button on the E-mail Rules tab. See screenshot:

6. Now in the Rules Wizard dialog box, please click to select the Apply rule on messages I receive option, and click the Next button.

7. In the Rules Wizard (which condition(s) do you want to check?) dialog box, please uncheck any option, and click the Next button. And then click the Yes button in the popping up Microsoft Outlook dialog box. See screenshot:

8. Now in the Rules Wizard (what do you want to do with the message?) dialog box, please: (1) Check the run a script option; (2) Click the text of a script to open the Select Script dialog box, select the script we added in Step 2 and click the OK button; (3) Click the Next button.

9. In the Rules Wizard (Are there any exceptions?) dialog box, please click the Next button directly.

10. Now in the last Rules Wizard dialog box, please name the rule in the Step 1 box, check options as you need in the Step 2 section, and click the Finish button.

11. Close the Rules and Alerts dialog box.

And now all attachments are downloaded from your email account and saved into the specified destination folder. And all attachments of incoming emails will be automatically downloaded and saved into the specified folder too.


Automatically download Outlook attachments to folder with Kutools for Outlook

If you have Kutools for Outlook installed, you can apply its Auto Detach option to automatically download all Outlook attachments and save to a certain folder easily.

Kutools for Outlook: Add more than 100 handy tools for Outlook, free to try with no limitation in 60 days. Read More      Free Trial Now

1. Click Kutools > Auto Detach > Enable to enable the Auto Detach feature.

2. Go ahead to click Kutools > Auto Detach > Auto Detach Manager.

3. In the Auto Detach Attachments dialog, check the Auto detach all received attachments option, and then configure as follows:
(1) Click the browse button  to specify the destination folder to save automatically detached attachments;
(2) It’s optional to check the Create subfolders in the following style option, and then select one subfolder style from below drop-down list;
(3) It’s optional to check the Only detach attachments with following extension option, and then type attachment file extensions into below box;
(4) It’s optional to check the Attachment icon is still remained in the emails options.

Note: If you need to automatically detach attachments by senders, you can check the Auto detach attachments by rules option, click the New button, and then type the sender’s email address and specify destination folder in the second Auto Detach Attachments dialog.

4. Click the Ok button to save the settings.

From now on, all attachments (or attachments with specified file extensions, or attachments from specified senders based on your settings) will be automatically saved.

Note: You can apply Kutools for Outlook’s Detach All (Attachments) feature or Save  All (Attachments) feature to quickly download/save all attachments from multiple/all received emails in Outlook.


Demo: Automatically download Outlook attachments to folder with Kutools for Outlook


Tip: In this Video, Kutools tab is added by Kutools for Outlook. If you need it, please click here to have a 60-day free trial without limitation!


Related articles:


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 

Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Hari · 2 months ago
    @Tom Hi Tom, I'm also facing the same problem..is that fixed for you??

  • To post as a guest, your comment is unpublished.
    GuestMas · 6 months ago
    @Brandie Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    MsgBox "E:\Dropbox\Apps\Attachments" & F
    sSaveFolder = "E:\Dropbox\Apps\" & Format(Now(), "dd.mm_hh.mm.ss")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    filng · 10 months ago
    @Shilpa Hi Shilpa. At colabel we are developing a no-code solution that can automatically categorize and store your attachments into folders. We're currently looking for qualified beta users willing to test our solution for free. In case you think we might help you, just send me an email at filippo@colabel.com
  • To post as a guest, your comment is unpublished.
    Shilpa · 11 months ago
    @Brandie HI All, I did all the steps but my script is not working.
  • To post as a guest, your comment is unpublished.
    Brandie · 1 years ago
    I got the script to run, everything works, but is there anyway to prevent the original email from being deleted? It is going directly into my "permanently deleted" files. I'd like the emails to stay right where they are rather than being deleted.

  • To post as a guest, your comment is unpublished.
    nilima · 1 years ago
    @cheunt2@gmail.com thank you so much! This solved my problem. Script was not running at all!
  • To post as a guest, your comment is unpublished.
    TGG · 1 years ago
    @jahangir because of security rules thisis not standard active from outlook 2013 and later.

    For outlook 2016 you need to add this to the registry:

    HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security
    DWORD: EnableUnsafeClientMailRules
    Value: 1
  • To post as a guest, your comment is unpublished.
    jahangir · 1 years ago
    i am not find "run a script" option please?
  • To post as a guest, your comment is unpublished.
    kellytte · 1 years ago
    @Sipho Hi sipho,
    If you enable the Auto Save Attachments or Auto Detach Attachments feature of Kutools for Outlook, they will save or detach attachments automatically from new incoming emails only when Outlook is running,
  • To post as a guest, your comment is unpublished.
    Joon Lin Ng · 1 years ago
    @cheunt2@gmail.com Thank you very much..
  • To post as a guest, your comment is unpublished.
    Sipho · 1 years ago
    Hi,


    Does Kutools automatically save the emails even when outlook is not opened and if not how can I do this?


    Thanks
  • To post as a guest, your comment is unpublished.
    Aftab · 1 years ago
    @cuatro2006@gmail.com HI, I need the entire timestamp in the file name to be saved as i am recieving the attachment everyhour
  • To post as a guest, your comment is unpublished.
    kellytte · 1 years ago
    @Guil Hi Guil,
    If you use the Detach All (Attachments) of Kutools for Outlook, you can specify to place the attachments into subfolders which are named as message subject-receive time.
  • To post as a guest, your comment is unpublished.
    Guil · 1 years ago
    Hi,

    How can I save this with a timestamp in the file name? The files I receive via e-mail always have the same name and the newer file overrides the previous one.

    Thanks in advance.

    Guil
  • To post as a guest, your comment is unpublished.
    Frodo · 1 years ago
    @Suz I was having the same problem, and enabling all macros fixed it for me as well.
  • To post as a guest, your comment is unpublished.
    Roberta · 2 years ago
    @kellytte Hi,
    I have retored the Run a script option in Outlook. But it still doesen't work. the message error is "This rule is not available in the current mode". Can you help me please?
  • To post as a guest, your comment is unpublished.
    Anthony · 2 years ago
    Hello, this code is running but MItem.Attachments.Count shows 0. When i try in debug mode watch this variable it reread and value shows more than 1. Help please. Why the variable didn't read in automatic mode?
  • To post as a guest, your comment is unpublished.
    kellytte · 2 years ago
    @Krishnakant Hi Krishnakant,
    In this article, I have introduced the method to restore the Run a script option in Outlook. Hope it can help you.
    https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Krishnakant · 2 years ago
    Hello,

    Its not showing 'run a script' action. Can you help please?


    Thanks

    Krishnakant
  • To post as a guest, your comment is unpublished.
    Katagihallimath · 2 years ago
    Is this correct?

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = "D:\Adarsh\My\Payslips\" & Year(Date)Format(Date, "DD") & Format(Date, "Mmm")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    Tom · 2 years ago
    My Computer will only download the attachments when I run the rule manually. it doesn't automatically download the attachments when new emails arrive. Is that how it is supposed to be or could I have something set up wrong?
  • To post as a guest, your comment is unpublished.
    Katagihallimath · 2 years ago
    Hello, I tried downloading the attachments to a folder but the code doesn't seem to work.

    Kindly Help.

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = "D:\Adarsh\My\Payslips\" & Year(Date)Format(Date, "DD") & Format(Date, "Mmm")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    Namig Heydarov · 2 years ago
    Hi all,
    I've running a command, but after restart of Outlook it stops. Do you have any idea how to solve it?
    Thanks!
  • To post as a guest, your comment is unpublished.
    James · 2 years ago
    Hi. Is it possible to save just the pdf files from the outlook attachment?
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    @Scott Hi, try whith this

    Path = "\\myfolder\folder1\"
    nombre = "filename"
    fecha = Year(Date) & Format(Month(Date), "00") & Format(Day(Date) , "00")
    olItem.Attachments(1).SaveAsFile Path & nombre & fecha & ".txt"
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    @Alex Hi, show me the script, maybe I can help you
  • To post as a guest, your comment is unpublished.
    Alex · 2 years ago
    I wrote the script but no files are saving to my folder. Any suggestions?
  • To post as a guest, your comment is unpublished.
    Scott · 2 years ago
    Is there a way to modify the file name to include the date (ie: Filename.Date.filetype)
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    Hello!
    I need that if the attachment is empty, that the macro left does not perform any action
  • To post as a guest, your comment is unpublished.
    Martin · 2 years ago
    In option 1, where am I supposed to hit ALT + F11? I tried with Outlook opened and it isn't working. Normal ALT + F11 does nothing, and ALT Gr + F11 opens my Intel HD Graphic Control Panel.
  • To post as a guest, your comment is unpublished.
    Rob · 2 years ago
    Has anyone been able to figure out a way for this to work if the files you are saving all have the same name?


    I get a bunch of files that I need to save daily, but there are at least 2 of each with the same name.


    If anyone has any suggestions that would be greatly appreciated!!
  • To post as a guest, your comment is unpublished.
    Jasmin Nolasco · 2 years ago
    @Alfredo Funes https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Almira · 2 years ago
    Can I save attachments from 1 category in my email box? I don't need all of them, so I need select it. I have trial version of Kutools and in Options I have just 3 tabs: General, Detach&save and Compress. I saw on the page, that you have tab Filter. So Can I select and make settings from which category to save attachments?
  • To post as a guest, your comment is unpublished.
    Almira · 2 years ago
    @kelly.extendoffice@gmail.com Hi! Did you finish with this project? I mean do you have new version which can do 1) and 2) steps? I need save attachments from 1 category in email box, I don't need all of attachments.
  • To post as a guest, your comment is unpublished.
    Alfredo Funes · 2 years ago
    what if "Run a Script" is not available in "What do you want to do with the message" section?
  • To post as a guest, your comment is unpublished.
    Raynardo Pardo · 3 years ago
    Hello, Is there a VBA script for CSV attachment. I currently have report jobs that automatically goes into named folders in outlook I would now like for those files in the folders extract itself and go into the corresponding folders on my desktop. Hope this makes sense. Please Help! I am very new to VBA.
  • To post as a guest, your comment is unpublished.
    Dan · 3 years ago
    Hello, a few questions:

    1) This software not only saves the attachments but also the email message itself as a png file correct?
    2) This software will let us save each new email in a new subfolder if we set it up correct?
    3) This software will let us set up filters to control which emails get sent to dropbox and which ones are passed on correct?

    Thank You!
  • To post as a guest, your comment is unpublished.
    maxgiaco01@gmail.com · 3 years ago
    Hi, if you need to manage widely the attachments this solution is the best, but if you own a Dropbox account there are some email providers that automatically upload every attachment to Dropbox account. It means that you get the attachment in dropbox folder even if you hadn't read the email. I use servermx.com because they did a customization about the Dropbox path where I need to put the attachments.
  • To post as a guest, your comment is unpublished.
    faitharces29@gmail.com · 3 years ago
    Hi there,

    After having gone through all the steps it does work. The only thing is that while it saves the message as a png file, I would also like the script to actually go to the link in the message and download the data from there. Any good ideas how to extend the script?

    Thanks,

    Laszlo
  • To post as a guest, your comment is unpublished.
    Suz · 3 years ago
    @regis.saintgirons@gmail.com Hi, had a problem with it as well. For me, it were the Outlook settings under Trust Centre. All macros had been disabled. Once I enabled the macros to run on outlook, the script appeared to run and save the file.
  • To post as a guest, your comment is unpublished.
    kelly001 · 3 years ago
    @regis.saintgirons@gmail.com Hi Regis,
    It's hard to figure out the problem. What about trying Kutools for Outlook’s Automatically Detach feature? This feature only requires you to check one options, and all attachments will be automatically downloaded to the specified folder in futre!
  • To post as a guest, your comment is unpublished.
    regis.saintgirons@gmail.com · 3 years ago
    @regis.saintgirons@gmail.com I should add that I am using a gmail inbox
  • To post as a guest, your comment is unpublished.
    regis.saintgirons@gmail.com · 3 years ago
    I need help please !

    I have implemented the rule and the macro as explained. I have even added a msgbox line to make sure that all was ok and it is as the mail subject is properly displayed but the attachement is not saved

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    MsgBox "Mail Subject: " & MItem.Subject
    sSaveFolder = "C:\Users\regis\Documents\Attach\"
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub


    What am I doing wrong?
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @Lahiri Shuvo Hi Lahiri,
    Kutools for Outlook has released the Detach All feature, and you can easily save all attachments in the specified mail folder by the new Detach All feature.
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @judith Hi Judith,
    Do you mean only save the attachments? Kutools for Outlook’s Detach All feature is designed to save all attachments from multiple emails.
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @judith In the lastest version of Outlook, the "run a script" option is removed from the Outlook rules. You can follow the method in this article to restore it: https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Lahiri Shuvo · 3 years ago
    With the VBA script, it's running perfectly for the whole mailbox but I just need to save attachments form a specific folder. Can anyone help me ?
  • To post as a guest, your comment is unpublished.
    judith · 3 years ago
    guys i want to save only documents not the email
  • To post as a guest, your comment is unpublished.
    judith · 3 years ago
    i am failing to get "run the script" in the rules wizard.
  • To post as a guest, your comment is unpublished.
    judith · 3 years ago
    Hello, i want to save my pdf documents from outlook inbox into a specific folder,i want my attachment to be saved as pdf files with its name so that when i open the documents in my webside it is written "qoute document" exactly the way it has been saved. or save the documents with subject line and email body.Does your application support the mentioned above? thanks for your respond in advance