StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1796795
Impressions6732083
Links
Imprint
Privacy Policy
Contact
Attachments: Delete the selection
Author: Michael BauerHomepage
Date: 08.08.2012Accessed: 7246
  
Description

There's no function in Outlook to remove multiple attachments from emails at once.

This example lists the attachments by name and deletes them if you wish.

Public Sub DeleteAttachments2()
  Dim coll As VBA.Collection
  Dim obj As Object
  Dim Atts As Outlook.Attachments
  Dim Att As Outlook.Attachment
  Dim Sel As Outlook.Selection
  Dim i&, Msg$

  Set coll = New VBA.Collection

  If TypeOf Application.ActiveWindow Is Outlook.Inspector Then
    coll.Add Application.ActiveInspector.CurrentItem
  Else
    Set Sel = Application.ActiveExplorer.Selection
    For i = 1 To Sel.Count
      coll.Add Sel(i)
    Next
  End If

  For Each obj In coll
    Set Atts = obj.Attachments
    Msg = ""
    For i = Atts.Count To 1 Step -1
      Msg = Msg & Atts(i).FileName & vbCrLf
    Next
    If MsgBox(Msg, vbYesNo Or vbQuestion, "Delete?") = vbYes Then
      For i = Atts.Count To 1 Step -1
        Atts.Remove i
      Next
      obj.save
    End If
  Next
End Sub
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]