Attachments Property

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


*expression   * Required. An expression that returns one of the objects in the Applies To list.


This Visual Basic for Applications (VBA) example uses the Remove method to remove all attachments from a forwarded 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 myolApp As Outlook.Application
    Dim myinspector As Outlook.Inspector
    Dim myItem As Outlook.MailItem
    Dim myattachments As Outlook.Attachments
    Set myolApp = CreateObject("Outlook.Application")
    Set myinspector = myolApp.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

Applies to | AppointmentItem Object | ContactItem Object | DistListItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object

See Also | PathName Property | Position Property