TextStream object
Facilitates sequential access to file.
Syntax
TextStream. { property | method }
The property and method arguments can be any of the properties and methods associated with the TextStream object. Note that in actual usage, TextStream is replaced by a variable placeholder representing the TextStream object returned from the FileSystemObject.
Remarks
In the following code, a
is the TextStream object returned by the CreateTextFile method on the FileSystemObject; WriteLine and Close are two methods of the TextStream object.
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("This is a test.")
a.Close
Methods
Method | Description |
---|---|
Close | Closes an open TextStream file. |
Read | Reads a specified number of characters from a TextStream file and returns the result. |
ReadAll | Reads an entire TextStream file and returns the result. |
ReadLine | Reads one line from a TextStream file and returns the result. |
Skip | Skips a specified number of characters when reading a TextStream file. |
SkipLine | Skips the next line when reading a TextStream file. |
Write | Writes a specified text to a TextStream file. |
WriteBlankLines | Writes a specified number of new-line characters to a TextStream file. |
WriteLine | Writes a specified text and a new-line character to a TextStream file. |
Properties
Property | Description |
---|---|
AtEndOfLine | Returns true if the file pointer is positioned immediately before the end-of-line marker in a TextStream file, and false if not. |
AtEndOfStream | Returns true if the file pointer is at the end of a TextStream file, and false if not. |
Column | Returns the column number of the current character position in an input stream. |
Line | Returns the current line number in a TextStream file. |
See also
- Objects (Visual Basic for Applications)
- Object library reference for Office (members, properties, methods)
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.