ファイル・システム・オブジェクト

FileSystemObjectオブジェクトを使用して、サーバー上のファイル・システムにアクセスします。

このオブジェクトはファイルを操作できます。このオブジェクトを使用してファイル・システム情報を取得することもできます。

次のコードは、テキスト・ファイル(c:\test.txt)を作成し、ファイルにテキストを書き込みます:

Dim fso, tso
Set fso = CreateObject("Scripting.FileSystemObject")
Set tso = fso.CreateTextFile("C:\test.txt", True)   ' Creates a text file (overwrites if exists).
tso.WriteLine("Hello, this is a test file.")        ' Writes text to the file.
tso.Close                                          ' Closes the file.

Set tso = Nothing
Set fso = Nothing