Remove attachments from Outlook 2007 emails in bulk

I need to remove the attachments, but leave the emails, for a large number of emails (over 1500) in a folder in my Outlook 2007. I am looking for a bulk way to do this.

I found some code on this site to do it for Calendar entries, but my knowledge of VB is low and I need to focus the removal on a single folder, or preferably, emails selected. The solution can't be universal.

I don't need to save this group of attachments, although if the option to toggle saving them was available, it could be useful in the future.

Does anyone know of any method to do this or any free or commercial software that can help?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This code will prompt you to select a folder.

It will the iterate through all the mail items, delete the attachments and save the edited messages



Sub KillAtt()
    Dim myolApp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Dim oMail As MailItem
    Dim oAtt As Attachment

    Set myolApp = CreateObject("Outlook.Application")
    Set myNameSpace = myolApp.GetNamespace("MAPI")
    Set myFolder = myNameSpace.PickFolder
    For Each oMail In myFolder.Items
        For Each oAtt In oMail.Attachments
End Sub

Open in new window

birwinAuthor Commented:
Thank you brettdj:
Is there any way to have it only delete selected items in a folder?
Create a workaround - ie, move all messages that you want to remove their attachments to a NEW folder that you have for this purpose

Then run the macro provided by Dave and move the messages back to the inbox

That would be an easy workaround and would let you control easily which messages you do this on and avoid mishaps.

Take care
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

birwinAuthor Commented:
I installed the code but when I try to run the Macro, I get this error alert popup.
"The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros."
This is even after I set the Security Level for Outlook to "No security check for macros (Not Recommended"
I have not used macros before in Outlook. I am using Outlook 2007.
Any idea how I can enable macros?
Have a look at How to remove attachments from outlook (2007) emails easily:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I had missed the later comments. Its not clear to me why you can't enable macro's, hopefully one of the outlook gurus can assist with this

@Gary, the link you posted is also code based.


The problem might be that you are using Word as the email editor, in which case you need to set the macro security in Word as well.
birwinAuthor Commented:
This program worked and did not display the error messages. Additionally, it had the feature of allowing me to select the emails, rather than have to move them to a new directory.
Glad to help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.