File.OpenAsTextStream Method (VB6) |
Yes
oFileObj.OpenAsTextStream ([IOMode[, Format]])
oFileObj
Use: Required
Data Type: File object
Any object variable returning a File object.
IOMode
Use: Optional
Data Type: IOMode constant
A constant specifying the purpose for opening the file.
Format
Use: Optional
Data Type: Tristate constant
A constant specifying ASCII or Unicode format.
A TextStream object.
Opens the referenced text file for reading or writing.
IOMode can be one of the following IOMode constants:
Constant | Value | Description |
---|---|---|
ForAppending | 8 | Opens the file in append mode; that is, the current contents of the file are protected, and new data written to the file is placed at the end of the file. |
ForReading | 1 | Opens the file for reading; you can't write to a file that has been opened for reading. |
ForWriting | 2 | Opens the file for writing; all previous file content is overwritten by new data. |
Unicode can be one of the following Tristate constants:
Constant | Value | Description |
---|---|---|
TristateUseDefault | -2 | Open as System default |
TristateTrue | -1 | Open as Unicode |
TristateFalse | 0 | Open as ASCII |
The default IOMode setting is ForReading (1).
The default Format setting is ASCII (False).
If another process has opened the file, the method fails with a "Permission Denied" error.