File.OpenAsTextStream Method (VB6) |
Named Arguments
Yes
Syntax
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.
Return Value
A TextStream object.
Description
Opens the referenced text file for reading or writing.
Rules at a Glance
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.
See Also
- FileSystemObject: OpenTextFile Method, TextStream Object
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.