ReadFromFile Method (CDONTS Attachment Object)

ReadFromFile Method (CDONTS Attachment Object)

The ReadFromFile method loads the contents of an attachment from a file.

Syntax

        objAttach.ReadFromFile(fileName) 

objAttach

Required. The Attachment object.

fileName

Required. String. The full path and file name to read from, for example C:\DOCUMENT\BUDGET.XLS.

Remarks

The ReadFromFile method replaces the existing contents of the Attachment object, if any.

The ReadFromFile method operates differently, depending on the value of the Attachment object's Type property. The following table describes its operation:

Attachment Type property

ReadFromFile operation

CdoFileData

Copies the contents of the specified file to the attachment.

CdoEmbeddedMessage

(Not supported)

Note   The current version of the CDO for NTS Library does not support ReadFromFile for CdoEmbeddedMessage attachments. These calls generate the run-time error CdoE_NO_SUPPORT.

You can load the contents of an attachment when you first create it by specifying the type and source parameters when you call the Add method of the Attachments collection.

See Also

Concepts

Attachment Object (CDONTS Library)