Name

mailitem.Attachments

Synopsis

Returns an Outlook Attachments collection that you can use to add or remove files to send as attachments. The following code clears all of the attachments from a MailItem:

    Sub RemoveAttachments(mi As MailItem)
        ' Requires reference to Microsoft Outlook.
        Dim at As Attachment
        For Each at In mi.Attachments
            at.Delete
        Next
    End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.