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

or

How to remove all attachments from email in Outlook?

Normally when you are previewing an email, you can delete an attachment with right clicking and select the Remove Attachment item. Sometimes there may be many attachments in an email message, and it will be tedious to remove them one by one. Here we arrange you with two easy tricks to remove all attachments in one email, and remove all attachments from multiple emails as well in Outlook.

Manually remove all attachments in one email message in Outlook

Remove all attachments from multiple email messages in Outlook with VBA code

Easily remove all attachments from one or multiple emails with Kutools for 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.

Manually remove all attachments in one email message in Outlook

It is easy to remove all attachments in a selected email messages with the Remove Attachments feature in Outlook.

Step 1: Select the email message whose attachments you will remove later.

Step 2: Click one of attachments in the Reading Pane to activate the Attachments Tools.

Step 3: Click the Select All button in the Selection group on the Attachments tab.

This step will enable you to select all attachments in this selected email messages at once.

Step 4: Click the Remove Attachment button in the Actions group on the Attachments tab.

Step 5: In the warning dialog box, click the Remove Attachments button.

Then all attachments in this selected email messages are deleted as soon as possible.

Note: The Remove Attachments feature works fine in Outlook 2010 and 2013, but not in Outlook 2007.


Remove all attachments from multiple email messages in Outlook with VBA code

If you want to remove all attachments from multiple email messages in Microsoft Outlook, the following method will help you do it easily. We recommend you enable all macros in your Microsoft Outlook firstly.

Step 1: Go to the folder of My Document, create a new folder, and name it as OLAttachments

Step 2: Select multiple email messages whose attachments you will remove later.

Note: You can select inconsecutive email messages with holding the Ctrl key and clicking.

You can select consecutive email messages with holding the Shift key and clicking.

Step 3: Open the VBA Editor with pressing the Alt key and F11 key at the same time.

Step 4: Expand the Project1 > Microsoft Outlook Objects in the left bar, and then double click the ThisOutlookSession to open it in the Editor. See following screen shot:

Step 5: Copy and paste the following VBA code in the editing pane.

Public Sub ReplaceAttachmentsToLink()
Dim objApp As Outlook.Application
Dim aMail As Outlook.MailItem 'Object
Dim oAttachments As Outlook.Attachments
Dim oSelection As Outlook.Selection
Dim i As Long
Dim iCount As Long
Dim sFile As String
Dim sFolderPath As String
Dim sDeletedFiles As String
 
    ' Get the path to your My Documents folder
    sFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
    On Error Resume Next
 
    ' Instantiate an Outlook Application object.
    Set objApp = CreateObject("Outlook.Application")
 
    ' Get the collection of selected objects.
    Set oSelection = objApp.ActiveExplorer.Selection
 
    ' Set the Attachment folder.
    sFolderPath = sFolderPath & "\OLAttachments"
 
    
    ' Check each selected item for attachments. If attachments exist,
    ' save them to the Temp folder and strip them from the item.
    For Each aMail In oSelection
 
    ' This code only strips attachments from mail items.
    ' If aMail.class=olMail Then
    ' Get the Attachments collection of the item.
    Set oAttachments = aMail.Attachments
    iCount = oAttachments.Count
     
       
    If iCount > 0 Then
     
        ' We need to 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 = iCount To 1 Step -1
         
            ' Save attachment before deleting from item.
            ' Get the file name.
            sFile = oAttachments.Item(i).FileName
             
            ' Combine with the path to the Temp folder.
            sFile = sFolderPath & "\" & sFile
             
            ' Save the attachment as a file.
            oAttachments.Item(i).SaveAsFile sFile
             
            ' Delete the attachment.
            oAttachments.Item(i).Delete
             
            'write the save as path to a string to add to the message
            'check for html and use html tags in link
            If aMail.BodyFormat <> olFormatHTML Then
                sDeletedFiles = sDeletedFiles & vbCrLf & "<file://" & sFile & ">"
            Else
                sDeletedFiles = sDeletedFiles & "<br>" & "<a href='file://" & _
                sFile & "'>" & sFile & "</a>"
            End If
             
                         
        Next i
        'End If
             
       ' Adds the filename string to the message body and save it
       ' Check for HTML body
       If aMail.BodyFormat <> olFormatHTML Then
           aMail.Body = aMail.Body & vbCrLf & _
           "The file(s) were saved to " & sDeletedFiles
       Else
           aMail.HTMLBody = aMail.HTMLBody & "<p>" & _
           "The file(s) were saved to " & sDeletedFiles & "</p>"
       End If
       
       aMail.Save
       'sets the attachment path to nothing before it moves on to the next message.
       sDeletedFiles = ""
    
       End If
    Next 'end aMail
     
ExitSub:
 
Set oAttachments = Nothing
Set aMail = Nothing
Set oSelection = Nothing
Set objApp = Nothing
End Sub

Step 6: Press the key of F5 to run this VBA code.

Now all attachments from selected email messages are removed, with leaving hyperlinks to each deleted attachment at the bottom of all selected email messages.


Easily remove all attachments from one or multiple emails with Kutools for Outlook (just several clicks)

The Detach All attachments utility of Kutools for Outlook can quickly remove all attachments from one or multiple selected emails in Outlook. Please do as follows.

Kutools for Outlook : with more than 20 handy Outlook add-ins, free to try with no limitation in 45 days.

1. Select one or multiple email messages with the attachments you want to remove, then click Kutools > Detach All. See screenshot:

2. In the Please select a folder dialog box, click the Browse button to select a folder to save all deleted attachments. Check the Create subfolders in the following style box, and then select a folder style from the drop-down list. And finally click the OK button. See screenshot:

3. Click the Yes button in the Detach All dialog box.

4. Then a Kutools for Outlook dialog box will pop up to tell you how many attachments are deleted. Please click the OK button. 

Now all attachments are removed immediately with only the hyperlinks leaving in selected emails. You can click the hyperlink to open the corresponding attachment as you need.

If you want to have a free trial of this utility, please go to free download the software first, and then go to apply the operation according above steps.


Demo: Easily remove all attachments from emails with Kutools for Outlook

Kutools for Outlook includes 20+ powerful features and tools for Microsoft Outlook. Free to try with no limitation in 45 days. Download the free trial now!


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.
  • To post as a guest, your comment is unpublished.
    René · 1 years ago
    Can somebody change the code so that only for example attachments named "TermsAndConditions.pdf" are deleted
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Rene,
      Please follow the steps in the above second method, run the below VBA code. In an opening dialog box, please enter the attachment's name with the file extension (such as test.docx), and then click the OK button to just remove it from the selected email.

      Sub ReplaceAttachmentsToLink()
      Dim xMail As Outlook.MailItem
      Dim xAttachments As Outlook.Attachments
      Dim xSelection As Outlook.Selection
      Dim i, xCount As Long
      Dim xFile, xFldPath, xDelFiles, xFileName As String
      Dim xFlag As Boolean

      xFldPath = CreateObject("shell.Application").NameSpace(5).self.Path
      On Error Resume Next
      Set xSelection = Outlook.ActiveExplorer.Selection
      xFldPath = xFldPath & "\OLAttachments"
      xFlag = False
      xFileName = InputBox("Attachment name:", "Kutools for Outlook")

      If StrPtr(xFileName) = 0 Then Exit Sub
      If xFileName <> "" Then
      For Each xMail In xSelection
      Set xAttachments = xMail.Attachments
      xCount = xAttachments.Count
      If xCount > 0 Then
      For i = xCount To 1 Step -1
      xFile = xAttachments.Item(i).FileName
      If xFileName = xFile Then
      xFlag = True
      xFile = xFldPath & "\" & xFile
      xAttachments.Item(i).SaveAsFile xFile
      xAttachments.Item(i).Delete
      If xMail.BodyFormat <> olFormatHTML Then
      xDelFiles = xDelFiles & vbCrLf & ""
      Else
      xDelFiles = xDelFiles & "
      " & "" & xFile & ""
      End If
      End If
      Next i
      If xFlag = True Then
      If xMail.BodyFormat <> olFormatHTML Then
      xMail.Body = xMail.Body & vbCrLf & "The file(s) were saved to " & xDelFiles
      Else
      xMail.HTMLBody = xMail.HTMLBody & "
      " & "The file(s) were saved to " & xDelFiles & "
      "
      End If
      End If
      xMail.Save
      xDelFiles = ""
      End If
      Next
      If xFlag = False Then
      MsgBox "The Attachment does not exist!"
      Else
      MsgBox "The attachment has been deleted."
      End If
      Else
      MsgBox "Please input a attachment name"
      End If
      Set xAttachments = Nothing
      Set xMail = Nothing
      Set xSelection = Nothing
      End Sub
  • To post as a guest, your comment is unpublished.
    Peter · 2 years ago
    Method 1 doesn't work here, as there's only 1 option under 'Selection': Copy.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Peter,
      Outlook users are reporting that the Select All (attachments) feature in Outlook 2016 is missing.
  • To post as a guest, your comment is unpublished.
    Dinesh · 2 years ago
    The VBA Code solution was great .... worked beautifully
  • To post as a guest, your comment is unpublished.
    Ray · 2 years ago
    Compile Error Sub or Function not defined??
  • To post as a guest, your comment is unpublished.
    Ciaran · 2 years ago
    VBA code worked great. Many thanks!
  • To post as a guest, your comment is unpublished.
    Lisa · 2 years ago
    Hi
    This was really helpful , but as all attachments were not saved when i tried again it gives a message "the macros in this project are disabled".....tried enabling macros in outlook but no luck, any one can help!

    Regards
    Lisa
  • To post as a guest, your comment is unpublished.
    John · 2 years ago
    This code was exactly what I was looking for. If you want to take it a step further .. Use the "More Commands" , Choose commands from drop down and choose "Macros"... you will see this macro and "Add>>"... Now you have a button at the very top. Custom select emails with attachments and click new macro button at top. Thank you again for posting this code!!!!! :-)
  • To post as a guest, your comment is unpublished.
    Mike · 3 years ago
    The code works beautifully. Just one thing I noticed, the code doesn't register attachments in certain types of emails such as invites or undeliverable emails. So if these emails are in a line of selected emails, the code will stop when it reaches one of these emails. You have to delete these attachments manually (or the entire email), then run the code again. Not sure if there is any way to alter the code so it takes these types of emails into account. Otherwise, this has been extremely helpful.
  • To post as a guest, your comment is unpublished.
    Gordon · 3 years ago
    I have use KU to remove attachments on multiple emails (about 100 so far), but it had not reduced the file size of my mailbox. Can you explain why this might be?
  • To post as a guest, your comment is unpublished.
    Dejan · 3 years ago
    How to change folder path to let's say, D instead of My Documents?
  • To post as a guest, your comment is unpublished.
    David South · 3 years ago
    Works for individual outlook messages but for multiple messages the attachments overwrote each other where the attachments were named the same.
  • To post as a guest, your comment is unpublished.
    Melody Scott · 3 years ago
    Great, thanks, exactly what I was looking for!
  • To post as a guest, your comment is unpublished.
    Wayne · 4 years ago
    Terrific tips! Thanks!
    • To post as a guest, your comment is unpublished.
      chasoe · 4 years ago
      Thx so much. In fact, I've been using the vba codes as shown in "Remove all attachments from multiple email messages in Outlook with VBA code', and the codes work fine.

      My point is I cannot modify the codes to convert the hyperlink to plain text. There is no use showing the hyperlink, as the linked folder/files will be deleted sooner or later as the volume increase to a certain size.

      Looking forward to your further advice.

      Best regards
  • To post as a guest, your comment is unpublished.
    Edward Chan · 4 years ago
    I find the VBA very good, but is it possible to convert the hyperlink to pure text, as it seems too many hyperlinks in the Outlook .pst file will eat up memory.

    In fact I only wish to retain the attachment file names, as relevant files have been saved (if necessary) already when the mail is read.

    Would anyone help ?
    Thx a lot.
  • To post as a guest, your comment is unpublished.
    Stuart · 4 years ago
    Code works fab,

    Is it possible to change the location that the attachments are saved? I use several different PCs at work, and having the attachments save onto the C:/.

    Can I save to network drive if I know the path?
  • To post as a guest, your comment is unpublished.
    omoyer · 4 years ago
    This code only removes attachments from the selected mail item. I am using 2013 if that is an issue
  • To post as a guest, your comment is unpublished.
    Cam Banks · 4 years ago
    This works partially; some attachments are removed, but many are not. Running Outlook 2013, 15.0.4701.1000. I would hesitate to purchase KU Tools if this can't be resolved first.
  • To post as a guest, your comment is unpublished.
    JW · 4 years ago
    well done. this is what I needed, many thanks
  • To post as a guest, your comment is unpublished.
    Sally · 4 years ago
    The attachments done appear to be detaching, I can still open the emails and the pdfs, any ideas? thanks.
  • To post as a guest, your comment is unpublished.
    Jon Williams · 4 years ago
    You can resolve the issue of two attachments with the same name, and create reverse traceability by altering the following line in the code.

    ' Save attachment before deleting from item.
    ' Get the file name.
    sFile = Format(aMail.SentOn, "YYYYMMDDHHNNSS") & "_" & oAttachments.Item(i).FileName

    This will add a date and time stamp in front of the attachment name.
  • To post as a guest, your comment is unpublished.
    Pablo Ruiz · 4 years ago
    This is awesome. However bear in mind if 2 attachments have hte same name, the older one will end up being written over.
  • To post as a guest, your comment is unpublished.
    Mick · 5 years ago
    Exactly what I was looking for - great piece of code - thank you
  • To post as a guest, your comment is unpublished.
    dre · 5 years ago
    Worked like a charm! Thanks a lot
  • To post as a guest, your comment is unpublished.
    Heather · 5 years ago
    Thank you!!! That worked a treat.