Close Method (FileSystemObject)

Switch View :
ScriptFree
Scripting Runtime Library
Close Method (FileSystemObject)

Closes an open TextStream file.


                      object.Close( ); 
Remarks

The object is always the name of a TextStream object.

The following example illustrates use of the Close method.

JScript
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");
a.Close();

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

See Also

Reference