Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to save all attachments from multiple emails to folder in Outlook?

As usual, when you receive messages with multiple attachments and you want to save these attachments to a specific folder, you need to save them one by one with some annoying operations. Do you want to get rid of that time-consuming operations and directly save the multiple attachments at once? Please look at the following tutorials.

Save all attachments from multiple emails to folder with VBA code

Several clicks to save all attachments from multiple emails to folder with Kutools for Outlook


Easily save all attachments from multiple selected emails to folder:

With the Detach All attachments utility of Kutools for Excel, you can easily save all attachments from multiple selected emails to specified folder in Outlook as below screenshot showed.

Kutools for Outlook: with more than 40 handy Outlook add-ins, free to try with no limitation in 45 days. Download and free trial Now!

Kutools for Outlook: 100+ New Advanced Tools for Outlook.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu: Bring Old Menus and Toolbars Back to Office 2007, 2010, 2013, 2016 and 2019.

Save all attachments from multiple emails to folder with VBA code

1. Firstly, you should create a folder for saving the attachments in your computer. The saving path just like the following screenshot shows, Lj is the user name of the computer, and the Attachments is the folder which you should finally create.

2. After creating the folder, press Alt + F11 to open the Microsoft Visual Basic for Applications window.

3. Then click Insert > Module to open the Module window, and then copy and paste the following VBA code to the window.

VBA code for saving attachments

Public Sub SaveAttachments()
'Update 20141121
	Dim objOL As Outlook.Application
	Dim objMsg As Outlook.MailItem
	Dim objAttachments As Outlook.Attachments
	Dim objSelection As Outlook.Selection
	Dim i As Long
	Dim lngCount As Long
	Dim strFile As String
	Dim strFolderpath As String
	Dim strDeletedFiles As String
	strFolderpath = CreateObject("WScript.Shell").SpecialFolders(16)
	Set objOL = CreateObject("Outlook.Application")
	Set objSelection = objOL.ActiveExplorer.Selection
	strFolderpath = strFolderpath & "\Attachments\"
	For Each objMsg In objSelection
		Set objAttachments = objMsg.Attachments
		lngCount = objAttachments.Count
		strDeletedFiles = ""
		If lngCount > 0 Then
			For i = lngCount To 1 Step -1
				strFile = objAttachments.Item(i).FileName
				strFile = strFolderpath & strFile
				objAttachments.Item(i).SaveAsFile strFile
'objAttachments.Item(i).Delete()
				If objMsg.BodyFormat <> olFormatHTML Then
					strDeletedFiles = strDeletedFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
				Else
					strDeletedFiles = strDeletedFiles & "<br>" & "<a href='file://" & _
					strFile & "'>" & strFile & "</a>"
				End If
				Next i
				If objMsg.BodyFormat <> olFormatHTML Then
					objMsg.Body = vbCrLf & "The file(s) were saved to " & strDeletedFiles & vbCrLf & objMsg.Body
				Else
					objMsg.HTMLBody = "<p>" & "The file(s) were saved to " & strDeletedFiles & "</p>" & objMsg.HTMLBody
				End If
				objMsg.Save
			End If
		Next
		ExitSub:
		Set objAttachments = Nothing
		Set objMsg = Nothing
		Set objSelection = Nothing
		Set objOL = Nothing
	End Sub

Note: This VBA code will permanently remove the attachment from the email.

4. Go to Outlook Mail section to select the emails with attachments which you want to save the attachments.

5. Return to the Microsoft Visual Basic for Applications window, and click button to run the code.

6. When a prompt box showing up, click Allow to save the attachment. Note: The prompt box’s showing frequencies depend on how many emails you have selected. If you have selected two emails with attachments, the prompt box will show up twice and you need to click Allow twice to finish all savings.

7. After finish all savings, you will see the result as shown in the below screenshots. You can go to find the saved attachments according to the saving path or open the attachment directly by just click on the saving path.


Save all attachments from multiple emails to folder with Kutools for Outlook (just several clicks)

This section will introduce the Detach All utility of Kutools for Outook. With this utility, you can quickly save attachments from multiple emails at once in Outlook.

Kutools for Outlook : with more than 20 handy Outlook add-ins, free to try with no limitation in 45 days.

1. Get into the email folder and select the multiple emails with attachments in mail list by holding the Ctrl key.

2. Then click Kutools > Detach All. See screenshot:

3. Then a Please select a folder dialog box pops up, please click the Browse button to select a folder to save the detached attachments, check the Create subfolders in he following style box, and then specify a folder style from the drop-down list. Finally click the OK button. See screenshot:

4. In the opening Detach All dialog box, please click the Yes button.

5. Then a Kutools for Outlook dialog box displays to tell you how many attachments are detached successfully, please click the OK button:

If you want to have a free trial of this utility, please go to free download the software first, and then go to apply the operation according above steps.


Demo: Save all attachments from multiple emails to folder with Kutools for Outlook

Kutools for Outlook includes 20+ powerful features and tools for Microsoft Outlook. Free to try with no limitation in 45 days. Download the free trial now!


Related articles:

 

Recommended Productivity Tools

shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121

Kutools for Outlook - More than 100 Advanced Functions for Outlook, Improve 70% Efficiency For you

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Forward multiple emails individually with one-click, and auto forward by rules.
  • Auto CC/BCC every sending email and easy for customizing rules, and auto reply without requiring exchange server.
  • Powerful junk emails filter, remove duplicate emails, reply with attachment, bunch of one-click operations, and so on...
  • 60-day unlimited free trial. 60-day money back guarantee. 2 years free upgrade and support. Buy once, use forever.
Say something here...
symbols left.
You are guest ( Sign Up? )
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.
    BG Davis · 1 months ago
    So I click the link "Kutools for outlook" and I'm directed to a page that is not that, but "Kutools - Combines More Than 300 Advanced Functions and Tools for Microsoft Excel."

    Nothing about Outlook. Waste of time.
  • To post as a guest, your comment is unpublished.
    Brian · 2 years ago
    This is what the code is at now, and it does save all the attachments, but it only adds text to the first message. Can anyone help me with this?

    Public Sub SaveAttachments()
    'Update 20170523
    Dim objOL As Outlook.Application
    Dim objMsg As Outlook.MailItem
    Dim objAttachments As Outlook.Attachments
    Dim objSelection As Outlook.Selection
    Dim I As Long
    Dim lngCount As Long
    Dim strFile As String
    Dim strFolderpath As String
    Set objOL = CreateObject("Outlook.Application")
    Set objSelection = objOL.ActiveExplorer.Selection
    strFolderpath = "C:\Users\brianp\Documents\Attachments\"
    For Each objMsg In objSelection
    Set objAttachments = objMsg.Attachments
    lngCount = objAttachments.Count
    'Use this to test MsgBox "Subject = " & objMsg.Subject & " lngCount = " & objAttachments.Count
    If lngCount > 0 Then
    For I = lngCount To 1 Step -1
    strFile = objAttachments.Item(I).FileName
    strFile = strFolderpath & strFile
    objAttachments.Item(I).SaveAsFile strFile
    Next I
    End If
    If objMsg.BodyFormat olFormatHTML Then
    objMsg.Body = vbCrLf & "The Attached file(s) were saved to " & "" & strFile & "" & vbCrLf & objMsg.Body
    Else
    objMsg.HTMLBody = "" & "The Attached file(s) were saved to " & "" & strFile & "" & "" & objMsg.HTMLBody
    End If
    Next
    ExitSub:
    Set objAttachments = Nothing
    Set objMsg = Nothing
    Set objSelection = Nothing
    Set objOL = Nothing
    End Sub
  • To post as a guest, your comment is unpublished.
    Brian · 2 years ago
    I can get this to run but how and the objSelection.Count is 2 but it will only save the attachments on the first email.
  • To post as a guest, your comment is unpublished.
    Atron Seige · 2 years ago
    Thanks! This saved me a lot of time and frustration!
  • To post as a guest, your comment is unpublished.
    Josh Fernandez · 2 years ago
    Works great with no problems! Thanks. Saved me a bunch of time!

    Thanks,

    Josh