Microsoft Scripting Runtime
FileSystemObject Object / OpenTextFile Method
In This Topic
    OpenTextFile Method
    In This Topic
    Description
    Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
    Syntax
    Visual Basic
    Public Function OpenTextFile( _
       ByVal FileName As String, _
       Optional ByVal IOMode As IOMode = ForReading, _
       Optional ByVal Create As Boolean = False, _
       Optional ByVal Format As Tristate = TristateFalse _
    ) As TextStream
    Parameters
    FileName
    IOMode
    ValueDescription
    ForAppendingOpen a file and write to the end of the file.
    ForReadingOpen a file for reading only. You can't write to this file.
    ForWritingOpen a file for writing. If a file with the same name exists, its previous contents are overwritten.
    Create
    Format
    ValueDescription
    TristateFalseOpens the file as ASCII.
    TristateMixedn/a
    TristateTrueOpens the file as Unicode.
    TristateUseDefaultOpens the file using the system default.
    See Also