How to save only specific (excel) attachment in Outlook?
Outlook provides a Save All Attachments feature for you to quickly save all attachments in an email to a specific folder at once. However, if you want to save only specific type of attachment in an email, such as Excel attachment, Word document and so on, what can you do to achieve it? Here we provide a VBA method to solve the problem.
Save only specific attachment in 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!
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by rules; 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 at once; Auto Add Greeting when reply; Auto Add Date&Time into subject...
- Attachment Tools: Auto Detach, Compress All, Rename All, Auto Save All... Quick Report, Count Selected Mails, Remove Duplicate Mails and Contacts...
- More than 100 advanced features will solve most of your problems in Outlook 2010-2019 and 365. Full features 60-day free trial.
Save only specific attachment in Outlook
The below VBA code can help to save only specific attachment in an email or multiple emails to a specific folder. Please do as follows.
1. Launch your Outlook, in the mailing list, select an email or multiple emails you will save specific attachment from.
2. Press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window. In the opening window, click Insert > Module, and then copy below VBA code into the Module window.
VBA code: Save only specific attachment in an email or multiple emails to a folder
Public Sub SaveSpecifyAttachments() 'Updated by ExtendOffice 20181130 Dim xItem As Object, xFldObj As Object Dim xSelection As Selection Dim xAttachment As Outlook.Attachment Dim xSaveFolder As String Dim xFSO As Scripting.FileSystemObject Dim xFilePath, xFilesSavePath As String Dim xExtStr As String, xExt As String Dim xExtArr() As String, xS As Variant On Error Resume Next Set xFldObj = CreateObject("Shell.Application").BrowseforFolder(0, "Select a Folder", 0, 16) Set xFSO = New Scripting.FileSystemObject If xFldObj Is Nothing Then Exit Sub xSaveFolder = xFldObj.Items.Item.Path & "\" Set xSelection = Outlook.Application.ActiveExplorer.Selection xExtStr = InputBox("Attachment Format:" + VBA.vbCrLf + "(Please separate multiple file extensions by comma.. Such as: .docx,.xlsx)", "Kutools for Outlook", xExtStr) If Len(Trim(xExtStr)) = 0 Then Exit Sub For Each xItem In xSelection If xItem.Class = olMail Then xFilesSavePath = "" For Each xAttachment In xItem.Attachments xFilePath = xSaveFolder & xAttachment.FileName xExt = "." & xFSO.GetExtensionName(xFilePath) xExtArr = VBA.Split(xExtStr, ",") xS = VBA.Filter(xExtArr, xExt) If UBound(xS) > -1 Then xAttachment.SaveAsFile xFilePath If xItem.BodyFormat <> olFormatHTML Then xFilesSavePath = xFilesSavePath & vbCrLf & "<file://" & xFilePath & ">" Else xFilesSavePath = xFilesSavePath & "<br>" & "<a href='file://" & xFilePath & "'>" & xFilePath & "</a>" End If End If Next If xItem.BodyFormat <> olFormatHTML Then xItem.Body = vbCrLf & "The file(s) were saved to " & xFilesSavePath & vbCrLf & xItem.Body Else xItem.HTMLBody = "<p>" & "The file(s) were saved to " & xFilesSavePath & "</p>" & xItem.HTMLBody End If xItem.Save End If Next Set xFSO = Nothing End Sub
3. Click Tools > References, in the References – Project dialog, check the Microsoft Scripting Runtime box and click the OK button.
4. Press the F5 key to run the code. In the popped out Browse for Folder dialog box, choose one folder to save the attachments.
5. And then, click OK, in the following Kutools for Outlook dialog box, enter the file extension of the attachment you will save into the text box and click OK.
Then only the specified attachments are saved.
Notes:
1. If you want to save different type of attachments, please enter the file extensions into the text box and separate them by comma.
2. After saving, an attachment saving path is displayed on the message body. You can open the attachment by clicking the hyperlink directly.
Related articles:
- How to save all attachments from email messages in Outlook?
- How to remove all attachments from email in Outlook?
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.


You are guest
or post as a guest, but your post won't be published automatically.
Be the first to comment.