Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

Kutools for Excel 21.00 HOT

300+ Powerful Features You Must Have in Excel

Kutools-for-Excel

Kutools for Excel is a powerful add-in that frees you from performing time-consuming operations in Excel, such as combine sheets quickly, merge cells without losing data, paste to only visible cells, count cells by color and so on. 300+ powerful features / functions for Excel 2019, 2016, 2013, 2010, 2007 or Office 365!

Read More Download Buy now

Office Tab 14.00HOT

Adding Tabbed Interface for Office

Office Tab

It enables tabbed browsing, editing, and managing of Microsoft Office applications. You can open multiple documents / files in a single tabbed window, such as using the browser IE 8/9/10, Firefox, and Google Chrome. It's compatible with Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365. Demo

Read More Download Buy now

Kutools for Outlook 12.00NEW

100+ Powerful Features for Outlook

Kutools-for-Outlook

Kutools for Outlook is a powerful add-in that frees you from time-consuming operations which majority of Outlook users has to perform daily! It can save your time from using Microsoft Outlook 2019, 2016, 2013, 2010 or Office 365!

Read More Download Buy now

Kutools for Word  9.00NEW

100+ Powerful Features for Word

Kutools-for-Word

Kutools for Word is a powerful add-in that frees you from time-consuming operations which majority of Word users have to perform daily! It can save your time from using Microsoft Word / Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365!

Read More Download Buy now

Classic Menu for Office

Bringing Back Your Familiar Menus

Restores the old look and menus of Office 2003 to Microsoft Office 2019, 2016, 2013, 2010, 2007 or Office 365. Don’t lose time in finding commands on the new Ribbon. Easy to deploy to all computers in enterprises and organizations.

Read More Download Buy now

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!

Office Tab - Enable Tabbed Editing and Browsing in Office, and Make Work Much Easier...
Kutools for Outlook - Brings 100 Powerful Advanced Features to Microsoft Outlook
  • 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:


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.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.

Feature Tutorials