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.
4 Answers
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.
OutlookAttachView is freeware.
3Outlook 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.
Here are some more options with this.
Sue Mosher's site 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
1After 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.basfile to the Project Explorer (Press Ctrl+R if you cannot see it) or via File >> Import File... (Ctrl+M).Run the
ExecuteSavingmacro to save attachments.Go back to Outlook UI, and then press Alt+F8 to open the Macros window.
Select
ExecuteSavingin 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.