关闭打开的 TextStream 文件。
语法
Object.Close
参数
Object:必需。始终为 TextStream 对象的名称。
注释
以下示例说明了 Close 方法的用法。
示例 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
示例 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