Save attachments from many emails at once in Outlook?

18

14

Someone sent me 200 emails overnight, with one file attachment apiece. sigh

I'm expecting another 200 each night for the next three nights (the emails come from a server, so asking them to batch them isn't possible).

The file attachments have unique filenames, so is there a straightforward way to save the attachments from the entire group of emails at once?

I'd hate to have to open each email individually, right click, save, rinse, repeat...

I'm fluent in VBA, very comfortable creating Excel macros, so I can imagine it should be relatively easy to traverse a given folder for all messages and save attachments for each, but I haven't written an Outlook macro before, not familiar with the object hierarchy.

richardtallent

Posted 2009-12-29T16:47:47.270

Reputation: 1 052

Answers

14

NirSoft's OutlookAttachView can do this easily, even from the command line!

OutlookAttachView scans all messages stored in your Outlook, and displays the list of all attached files that it finds. You can easily select one or more attachments and save all of them into the desired folder, as well as you can delete unwanted large attachments that take too much disk space in your mailbox. You can also save the list of attachments into xml/html/text/csv file.

alt text

OutlookAttachView is freeware.

John T

Posted 2009-12-29T16:47:47.270

Reputation: 149 037

Thanks for this utility. Helped with what I wanted to do this morning: download 99 pdf attachments in my inbox in a go. – Chaitanya MSV – 2016-04-12T23:31:52.463

6

Outlook Attachment Remover Add-in:

Free Outlook add-in for saving and extracting attachments, decreasing the size of your Outlook files. Easy-to-use. Plenty of features.

image

harrymc

Posted 2009-12-29T16:47:47.270

Reputation: 306 093

1This did not work on Outlook 2013. The add-in is simply nowhere to be found, and not recognised when I attempted to load it manually. – Milind R – 2017-10-30T07:15:54.157

3

Here are some more options with this.

Sue Mosher's site http://slipstick.com is a fantastic resource for Outlook. She is also a Microsoft MVP as well.

For you coders out there: Save Attachments to the hard drive and alternatively Save and Open an Attachment using VBA.

The following code works in Outlook 2000 and up. It saves the attachments from selected messages but does not delete the attachments from the message(s).

Copy and paste the code from this page into your ThisOutlookSession project.

In Outlook, press Alt+F11 to open the VBA editor and expand Microsoft Outlook Objects then double click on ThisOutlookSession to open it in the editing pane and Ctrl+V to paste the code.

To use it you must first create a folder under your My Documents named OLAttachments (the code will not create it for you). Then select one or more messages and run the macro to save the attachments. You'll need to set macro security to warn before enabling macros or sign the macro. You can change the folder name or path where the attachments are saved by editing the code.

Public Sub SaveAttachments()
Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem 'Object
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

    ' Get the path to your My Documents folder
    strFolderpath = CreateObject("WScript.Shell").SpecialFolders(16)
    On Error Resume Next

    ' Instantiate an Outlook Application object.
    Set objOL = CreateObject("Outlook.Application")

    ' Get the collection of selected objects.
    Set objSelection = objOL.ActiveExplorer.Selection

' The attachment folder needs to exist
' You can change this to another folder name of your choice

    ' Set the Attachment folder.
    strFolderpath = strFolderpath & "\OLAttachments\"

    ' Check each selected item for attachments. 
    For Each objMsg In objSelection

    Set objAttachments = objMsg.Attachments
    lngCount = objAttachments.Count

    If lngCount > 0 Then

    ' Use a count down loop for removing items
    ' from a collection. Otherwise, the loop counter gets
    ' confused and only every other item is removed.

    For i = lngCount To 1 Step -1

    ' Get the file name.
    strFile = objAttachments.Item(i).FileName

    ' Combine with the path to the Temp folder.
    strFile = strFolderpath & strFile

    ' Save the attachment as a file.
    objAttachments.Item(i).SaveAsFile strFile

    Next i
    End If

    Next

ExitSub:

Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub

And if you don't want to program: Attachment Management Tools for Outlook

Leptonator

Posted 2009-12-29T16:47:47.270

Reputation: 441

In my case all my emails had the same subject line so each filesave overwrote the previous one, leaving me with one single file. The quick and dirty fix I did was to prepend an index number so every file is guaranteed unique, like this:

below the current declarations add: Dim Index As Long and next line Index = 1

Change: strFile = strFolderpath & strFile to strFile = strFolderpath & Index & "_" & strFile

and before "Next i" add: Index = Index + 1 – Stax – 2019-07-09T01:13:47.593

0

After I was bombed with e-mails from a person who thought it was nice to send me a split RAR file in 30 mails, I've successfully used this VBA script published by Microsoft called mAttachmentSaver.

First, you have to download the archive containing the script.

It's important that macros are enabled. In Outlook 2010, you can do that by going to File » Options » Trust Center » Trust Center Settings » Macro Settings » Enable all macros » OK » OK. Then you need to restart Outlook. For earlier versions, it's under Tools » Macro » Security….

Then, follow the steps outlined in the TechCenter article:

  • Press Alt+F11 to open the VBE in Outlook.

  • Drag the mAttachmentSaver.bas file to the Project Explorer (Press Ctrl+R if you cannot see it) or via File >> Import File... (Ctrl+M).

    Run the ExecuteSaving macro to save attachments.

  • Go back to Outlook UI, and then press Alt+F8 to open the Macros window.

  • Select ExecuteSaving in the names list, and then click the Run button (Please remember to select Outlook item(s) before running this macro).

  • Select a specific folder to save attachments from Browse For Folder dialog box, and then click the OK button.

slhck

Posted 2009-12-29T16:47:47.270

Reputation: 182 472