How To Save Only Specific (Excel) Attachment In Outlook?
Outlook provides the Save All Attachments feature to help you saving all attachments in an email to a specific folder at one time. However, if you want to save only certain types of attachments in one or more emails, such as Excel workbooks, Word documents and so on, how do you achieve it? In this tutorial, we provide you two methods to solve this problem.
Save only specific file format attachments in Outlook with VBA code
Easily save only specific file format attachments in Outlook with an amazing tool
Save only specific file format attachments in Outlook with VBA code
The following VBA code can help to save only specific file format attachments in one or more selected emails to a specific folder. Please do as follows.
1. Launch your Outlook. In the Mail list, select one or more emails from which you want to save only attachments in a specific file format.
2. Press "Alt" + "F11" 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 20210617
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 & "" & "" & xFilePath & ""
End If
End If
Next
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".
Note: For multiple file extensions, you need to separate them with commas.
Then only the specified attachments are saved.
Easily save only specific file format attachments in Outlook with an amazing tool
If you are new to VBA, here we recommend you to use the Save All attachments feature of "Kutools for Outlook". With this feature, you can easily save only attachments in a specific file format in Outlook.
1. Select the emails from which you want to save only attachments in a specific file format.
2. Click "Kutools" > "Attachment Tools" > "Save All".

3. In the "Save Settings" dialog box, you need to configure as follows.


4. A dialog box pops up reminding you if you want to save the attachments, click "OK" to continue.
5. Then another dialog box pops up to tell you how many attachments have been saved, click the "OK" button.

Now only the specific file format attachments are saved.
Related articles:
- How to save all attachments from email messages in Outlook?
- How to remove all attachments from email in Outlook?
Best Office Productivity Tools
Breaking News: Kutools for Outlook Launches Free Version!
Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!
π€ Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.
π§ Email Automation: Auto Reply (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
π¨ Email Management: Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
π Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
π Interface Magic: πMore Pretty and Cool Emojis / Remind you when important emails come / Minimize Outlook Instead of Closing ...
π One-click Wonders: Reply All with Attachments / Anti-Phishing Emails / πShow Sender's Time Zone ...
π©πΌβπ€βπ©π» Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Use Kutools in your preferred language β supports English, Spanish, German, French, Chinese, and 40+ others!


π One-Click Download β Get All Office Add-ins
Strongly Recommended: Kutools for Office (5-in-1)
One click to download five installers at once β Kutools for Excel, Outlook, Word, PowerPoint and Office Tab Pro. Click to download now!
- β One-click convenience: Download all five setup packages in a single action.
- π Ready for any Office task: Install the add-ins you need, when you need them.
- π§° Included: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint