Attachments.Add(Object, Object, Object, Object) Attachments.Add(Object, Object, Object, Object) Method


Creates a new attachment in the Attachments collection.

public Microsoft.Office.Interop.Outlook.Attachment Add (object Source, object Type, object Position, object DisplayName);
Public Function Add (Source As Object, Optional Type As Object, Optional Position As Object, Optional DisplayName As Object) As Attachment


Object Object

The source of the attachment. This can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.

Object Object

The type of the attachment. Can be one of the OlAttachmentType constants.

Object Object

This parameter applies only to e-mail messages using Microsoft Outlook Rich Text format: it is the position where the attachment should be placed within the body text of the message. A value of 1 for the Position parameter specifies that the attachment should be positioned at the beginning of the message body. A value 'n' greater than the number of characters in the body of the e-mail item specifies that the attachment should be placed at the end. A value of 0 makes the attachment hidden.

Object Object

This parameter applies only if the mail item is in Rich Text format and Type is set to olByValue: the name is displayed in an Inspector object for the attachment or when viewing the properties of the attachment. If the mail item is in Plain Text or HTML format, then the attachment is displayed using the file name in the Source parameter.


An Attachment object that represents the new attachment.


When an Attachment is added to the Attachments collection of an item, the Type property of the Attachment will always return olOLE (6) until the item is saved. To ensure consistent results, always save an item before adding or removing objects in the Attachments collection.

Applies to