• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1038
  • Last Modified:

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?
0
birwin
Asked:
birwin
  • 3
  • 3
  • 2
  • +1
1 Solution
 
Dave BrettVice President - Business EvaluationCommented:
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

Cheers

Dave

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
            oAtt.Delete
        Next
        oMail.Save
    Next
End Sub

Open in new window

0
 
birwinAuthor Commented:
Thank you brettdj:
Is there any way to have it only delete selected items in a folder?
0
 
dandrakaCommented:
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
0
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

 
birwinAuthor Commented:
brettdj:
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?
0
 
tbsgadiCommented:
Have a look at How to remove attachments from outlook (2007) emails easily:

http://blogs.msdn.com/nicold/archive/2009/10/22/how-to-remove-attachments-from-outlook-2007-emails-easily.aspx

Gary
0
 
Dave BrettVice President - Business EvaluationCommented:
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.

Regards

Dave
0
 
tbsgadiCommented:
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.
0
 
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.
0
 
tbsgadiCommented:
Glad to help!
0

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now