The Attachments property returns a single Attachment object or an Attachments collection object. Read-only.
Set collAttachments = objMessage.Attachments Set objAttach = objMessage.Attachments(index)
Object (Attachment or Attachments collection)
You can change individual Attachment objects within the Attachments collection, Add them to the collection, and Delete them from the collection.
Although the Attachments property itself is read-only, the collection it returns can be accessed in the normal manner through its Add and Delete methods, and the properties on its member Attachment objects retain their respective read/write or read-only accessibility.
The CDO for NTS Library does not permit any modifications to messages in the Inbox, other than deleting the entire message. Prohibited modifications include adding, deleting, or modifying any attachment; adding, deleting, or modifying any recipient; and modifying any message property, even one with read/write access.
This code fragment uses the Attachments property to retrieve an attachment of the message:
Set collAttachments = objMessage.Attachments If collAttachments Is Nothing Then MsgBox "Unable to set Attachments collection" Exit Function Else MsgBox "Attachments count for this message: " & collAttachments.Count iAttachCollIndex = 0 ' reset global index variable End If ' from the sample function Attachments_FirstItem iAttachCollIndex = 1 Set objAttach = collAttachments.Item(iAttachCollIndex)