WriteToFile Method (CDONTS Attachment Object)
WriteToFile Method (CDONTS Attachment Object)
The WriteToFile method saves the attachment to a file in the file system.
Syntax
objAttach.WriteToFile(fileName)
objAttach
Required. The Attachment object.
fileName
Required. String. The full path and file name for the saved attachment, for example C:\DOCUMENT\BUDGET.XLS.
Remarks
The WriteToFile method overwrites the file without warning if a file of that name already exists. Your application should check for the existence of the file before calling WriteToFile.
The WriteToFile method operates differently, depending on the value of the Attachment object's Type property. The following table describes its operation:
Attachment Type property |
WriteToFile operation |
CdoFileData |
Copies the contents of the attachment to the specified file. |
CdoEmbeddedMessage |
(Not supported) |
Note The current version of the CDO for NTS Library does not support WriteToFile for CdoEmbeddedMessage attachments. These calls generate the run-time error CdoE_NO_SUPPORT.