Attachments Property
Collapse the table of content
Expand the table of content

MailItem.Attachments Property (Outlook)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns an Attachments object that represents all the attachments for the specified item. Read-only.

expression .Attachments

expression A variable that represents a MailItem object.

This Visual Basic for Applications (VBA) example uses the Attachments.Remove method to remove all attachments from a forwarded mail message before sending it on to 'Dan Wilson'. To run this example, replace 'Dan Wilson' with a valid recipient's name and keep an item with attachments open in an inspector window.

Sub RemoveAttachmentBeforeForwarding() 
 Dim myinspector As Outlook.Inspector 
 Dim myItem As Outlook.MailItem 
 Dim myattachments As Outlook.Attachments 
 Set myinspector = Application.ActiveInspector 
 If Not TypeName(myinspector) = "Nothing" Then 
 Set myItem = myinspector.CurrentItem.Forward 
 Set myattachments = myItem.Attachments 
 While myattachments.Count > 0 
 myattachments.Remove 1 
 myItem.Recipients.Add "Dan Wilson" 
 MsgBox "There is no active inspector." 
 End If 
End Sub
© 2015 Microsoft