0

I have a huge amount of sent email containing attachments that I no longer need.

I know that I can open each message manually and remove each attachment, but I can't possibly do this for several 100 messages without injury or loss of income.

Is there some way to aggregate / automate attachment removal?

  • Large emails can be found from File > Info > Mailbox Cleanup > Find items larger than
  • I want to somehow select all and remove only the attachments and not delete the message.

2 Answers2

1

If you are ok with 3rd Party addons, here are a couple - Kopf Outlook Attachment Remover or Attachment Save. Both move the attachment to an external location and replace the entry with the link, not quite what you want, but might be close enough. Outlook Attachment Sniffer Seems to have the option to just "Remove" the attachment.

Alternatively, if you are in the mood to go scripting, there is this

Karthik T
  • 2,784
0

These addins no longer work on Outlook 365 (as of nov 2023). It's much easier to create a VBA macro.

The macro below will delete all attachments from the emails that you have currently selected.

Follow these steps to implement and run the macro:

  1. Open Outlook: Start Microsoft Outlook on your computer.

  2. Access the VBA Editor:

    • Press Alt + F11 to open the VBA editor.
    • In the VBA editor, go to Insert > Module to open a new module.
  3. Paste the Macro:

    • Copy the following VBA code and paste it into the module you just opened.
    Sub DeleteAttachmentsFromSelectedMails()
        Dim objSelection As Outlook.Selection
        Dim objItem As Object
        Dim objMail As Outlook.MailItem
        Dim i As Integer
        Dim objAttachments As Outlook.Attachments
        Dim intCount As Integer
    
    ' Get the collection of selected objects
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
    
    For Each objItem In objSelection
        ' Check if the selected item is a mail item
        If objItem.Class = olMail Then
            Set objMail = objItem
            Set objAttachments = objMail.Attachments
            intCount = objAttachments.Count
    
            ' Loop through the attachments and remove them
            While intCount > 0
                objAttachments.Item(1).Delete
                intCount = intCount - 1
            Wend
    
            ' Save the mail item
            objMail.Save
        End If
    Next
    
    MsgBox "Attachments removed from selected emails.", vbInformation
    

    End Sub

  4. Run the Macro:

    • Close the VBA editor.
    • In Outlook, select the emails from which you want to remove attachments.
    • Press Alt + F8, select DeleteAttachmentsFromSelectedMails, and then click Run.
    • You can also customize the Ribbon to add a button with this Macro

Important Notes:

  • Backup Emails: Before running this macro, it's a good idea to backup your emails, as this process is irreversible. There are no confirmation steps. When you launch the macro, it immediately deletes all attachments for all selected emails.
  • Macro Security Settings: Depending on your macro security settings, you might need to enable macros or add your VBA project as a trusted source.
  • Version Compatibility: This macro is intended for use in Microsoft Outlook 365 (as ov Nov 2023). It may not be compatible with all versions of Outlook, so you might need to adjust it for your specific version.
Fab
  • 1