Skip to main content

How to remove specific types of attachments from emails in Outlook?

Author Xiaoyang Last modified

Managing email attachments in Outlook can be challenging, especially when certain file typesโ€”like .docx or .pngโ€”clutter your inbox. While Outlook lacks a built-in feature to remove specific attachments from multiple emails at once, there are efficient solutions. You can use VBA scripting to manually delete attachments based on file type, or go with a faster, more user-friendly solution with Kutools for Outlook, which lets you filter and remove attachments in just a few clicks. This guide will walk you through both methods.

Remove a specific type of attachments using VBA (Manual and Technical)

Quickly remove specific types of attachments with Kutools for Outlook ๐Ÿ‘ (Fast and User-friendly)


Remove a specific type of attachments using VBA

Step 1: Select multiple emails

In the Mail view, select the emails with attachments you want to remove.

Tip: Holding Ctrl and clicking individual emails for non-adjacent selection. Or holding Shift and clicking the first and last email to select a range.

Step 2: Open the VBA editor

Press Alt + F11 to open the Microsoft Visual Basic for Applications window.

Step 3: Add the VBA code

In the VBA window, click Insert > Module to create a new module. Then copy the following VBA script and paste it into the new module:

VBA: Remove a specific type of attachments from emails

Sub DeleteSpecificTypeOfAttachments()
Dim xSelection As Outlook.Selection
Dim xItem As Object
Dim xMailItem As Outlook.MailItem
Dim xAttachment As Outlook.Attachment
Dim xFileType As String
Dim xType As String
Dim xFSO As Scripting.FileSystemObject
Dim I As Integer
On Error Resume Next
Set xSelection = Outlook.Application.ActiveExplorer.Selection
Set xFSO = New Scripting.FileSystemObject
xType = ""
xType = InputBox("Enter the attachment type to remove (e.g., docx, png):", "Kutools for Outlook", xType, 8)
If Len(Trim(xType)) = 0 Then Exit Sub
For Each xItem In xSelection
    If xItem.Class = olMail Then
        Set xMailItem = xItem
        If xMailItem.Attachments.Count > 0 Then
            For I = xMailItem.Attachments.Count To 1 Step -1
                Set xAttachment = xMailItem.Attachments.Item(I)
                xFileType = xFSO.GetExtensionName(xAttachment.FileName)
                If InStr(1, xFileType, Trim(xType), vbTextCompare) > 0 Then
                    xAttachment.Delete
                End If
            Next I
            xMailItem.Save
        End If
    End If
Next
Set xMailItem = Nothing
Set xFSO = Nothing
End Sub

Step 4: Enable the Microsoft Scripting Runtime

1. In the VBA editor, click Tools > References.

2. In the References - Project1 dialog box, check the Microsoft Scripting Runtime box and click OK.

doc remove attach by type 1

Step 5: Run the VBA script

1. Press F5 or click the Run button to execute the code.

2. A prompt box will appear, enter the attachment type you want to remove (e.g., xlsx). Click OK.

doc remove attach by type 2

Result

The VBA script will remove all attachments matching the specified type from the selected emails.

doc remove attach by type 3

Limitations of This Method:

  • โŒ Requires VBA knowledge: Not beginner-friendly and may be difficult for non-technical users.
  • โŒ No preview or undo: Once attachments are deleted, they cannot be restored.
  • โŒ Manual execution required: The script must be run every time you need to remove attachments.
  • โŒ Potential for accidental deletion: If you enter the wrong file type, unintended attachments may be removed.

If you frequently need to remove attachments from emails, the Kutools for Outlook method is a far more efficient and user-friendly solution.


๐Ÿ“‚ Automatically Archive Attachments with Ease!

Managing large volumes of email attachments just got effortless! With Kutools for Outlookโ€™s Auto Detach feature, incoming attachments are automatically saved to a designated folder and replaced with hyperlinks in emails. Say goodbye to manual processes and cluttered inboxesโ€”embrace seamless automation today!

Auto Detach Feature in Kutools for Outlook

๐Ÿ’ก Benefits You'll Love:

  • โœ”๏ธ Save attachments automatically as they arrive
  • โœ”๏ธ Keep emails clutter-free with hyperlink replacements
  • โœ”๏ธ Fully customizable options to suit your workflow

Quickly remove specific types of attachments with Kutools for Outlook ๐Ÿ‘

For a more efficient and user-friendly solution, Kutools for Outlook offers the Detach All feature, allowing you to remove specific file types from multiple emails in just a few clicks. Unlike the VBA method, no coding or manual execution is required.

Unlock ultimate email efficiency with Kutools for Outlook! Access 70 powerful features absolutely free, forever. Download the Free Version Now!

Step 1: Select multiple emails and access the Detach All feature

In the Mail view, select the emails containing the attachments you want to remove. Then click Kutools Plus > Attachment Tools > Detach All.

shot of the Detach All button

๐Ÿ“Œ Tip: Hold Ctrl to select multiple non-adjacent emails or the Shift to select a range of adjacent emails.

Step 2: Set detach preferences

  1. Click the the folder icon Browse icon to specify a destination folder for saving the attachments.
  2. Click Advanced options to expand the dialog.
  3. In the Filter conditions section, check the Attachment type box. Then enter the file extensions (e.g., .docx; .png) you want to remove in the textbox.
  4. Click OK to confirm.
    shot of the Detach Settings dialog box

Step 3: Confirm the detachment

A Detach All confirmation dialog box will appear. Click Yes to proceed.

shot of the Detach All confirmation dialog box

Result: What Happens Next?

1. All specified attachments are detached from the selected emails.

2. Attachments are safely stored in the specified folder instead of being permanently deleted. If needed, you can restore them by clicking Kutools Plus > Attachment Tools > Restore All.

3. Each hyperlink in the original email represents a detached file, providing quick access while keeping your inbox organized.

Why Choose This Method?

  • โœ… No technical skills required: Simple, intuitive, and beginner-friendly.
  • โœ… One-click batch processing: Removes attachments from multiple emails at once.
  • โœ… Safe and organized: Unlike VBA, attachments arenโ€™t deleted but saved elsewhere.
  • โœ… Flexible customization: Filter by attachment type, email sender, date range, and more.
Note: To apply the Detach All  utility of Kutools for Outlook, firstly, you should download and install Kutools for 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 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