ADO » Stream » SaveToFile

Version: 2.5

streamobject.SaveToFile FileName, SaveOptions
The FileName parameter is a string that is the name of the file (including the path, if needed) into which the data will be saved. This can be the name of an existing file or a new file you wish to create.
The optional SaveOptions parameter is one of the SaveOptionsEnum constants that allow you to either overwrite an existing file or create a new file. If left blank, the default is to create a new file.

Copies (saves) the contents of an opened Stream object to a specified file.

The SaveToFile method can be called when you want to save the binary contents of a Stream object to a local file. This can be an already existing file or a newly created file. After the save is accomplished, the position will be set to zero. If you save to an existing file, all existing bytes contained in the file will be completely overwritten.

This method does not change or affect the Stream object in any way.

There is one mandatory and one optional parameter.

SaveOptionsEnum Constants

Constant Value Description
adSaveCreateNotExist 1 Default, creates a new file
adSaveCreateOverwrite 2 Completely overwrite data in an existing file


objStream.SaveToFile Chant43.txt, adSaveCreateOverwrite

See Also: