The WriteToFile method saves the attachment to a file in the file system.
objAttach.WriteToFile(fileName)
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.