Skip to main content

Kutools for Office β€” One Suite. Five Tools. Get More Done.

How To Save Only Specific (Excel) Attachment In Outlook?

Author Siluvia Last modified

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.

steps on saving only Specific (Excel) Attachment In Outlook using vba

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.

steps on saving only Specific (Excel) Attachment In Outlook using vba

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.

steps on saving only Specific (Excel) Attachment In Outlook using vba

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.

 πŸ‘‰ Kutools for Outlook has a free version now, whose 70+ features are free for a lifetime. Download the Free Version Now.

1. Select the emails from which you want to save only attachments in a specific file format.

2. Click "Kutools" > "Attachment Tools" > "Save All".

steps on saving only Specific (Excel) Attachment In Outlook using kutools for outlook

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

3.1) In the "Save attachment(s) to this folder" section, click the steps on saving only Specific (Excel) Attachment In Outlook using kutools for outlook button to select a folder to save the attachments;
3.2) Click the "Advanced options" button to unfold the dialog box;
3.3) In the "Filter conditions" section, check the "Attachment type" checkbox, then enter the file extension of the attachments you will save into the text.
Tips: For multiple file extensions, you need to separate them with semicolons.
3.4) Click the "OK" button. See screenshot:
steps on saving only Specific (Excel) Attachment In Outlook using kutools for outlook

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.

steps on saving only Specific (Excel) Attachment In Outlook using kutools for outlook

Now only the specific file format attachments are saved.


Related articles:


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 ProBatch 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!

Instantly unlock Kutools for Outlook with a single click. Don't wait, download now and boost your efficiency!

kutools for outlook features1 kutools for outlook features2

πŸš€ 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