Close Method

Closes an open TextStream file.

Syntax

Object.Close

Arguments

Object: Required. Always the name of a TextStream object.

Remarks

The following example illustrates use of the Close method.

Example 1:

Sub CreateAFile
   Dim fso, tso
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set tso = fso.CreateTextFile("c:\testfile.txt", True)
   tso.WriteLine("This is a test.")
   tso.Close
End Sub

Example 2:

Sub AppendToFile
    Dim fso, tso
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set tso = fso.OpenTextFile("C:\testfile.txt", 8)
    tso.WriteLine("Appending this text.")
    tso.Close
End Sub