Name Property (CDONTS Attachment Object)

The Name property returns or sets the display name of the Attachment object as a string. Read/write (read-only for an attachment on a message in the Inbox).

Syntax

objAttach.Name 
 

The Name property is the default property of an Attachment object, meaning that objAttach is syntactically equivalent to objAttach.Name in Microsoft® Visual Basic® code.

Data Type

String

Remarks

Before setting or changing the Name property, you should be sure that the Source property is already set. Setting Source after setting Name can result in an incorrect value for Name.

If the attachment's Type property is set to CdoEmbeddedMessage, any setting of the Name property is ignored in the current version of CDO for NTS. If the MessageFormat property of the grandparent Message object is set to CdoMime, the embedded message's Subject property is used for the attachment name. If the grandparent message's MessageFormat is CdoText, CDO for NTS randomly creates an attachment name in the format ATT00099.EML.

The Name property can also be set at the time of creation of the attachment by supplying the name parameter to the Add method of the Attachments collection.