Objeto File System

O objeto FileSystemObject é usado para acessar o sistema de arquivos em um servidor.

Este objeto pode manipular arquivos. Também é possível recuperar informações do sistema de arquivos com este objeto.

O código a seguir cria um arquivo de texto (c:\test.txt) e grava texto nesse arquivo:

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