-
Step 1
Create an object to for the new file. This object is used in the code to create the file and assign it to a variable so that it can be manipulated:
set myFile = server.CreateObject("Scripting.FileSystemObject") -
Step 2
Create the file and assign it to a variable. The newly created "myFile" object creates the file, and it needs a handler so that the program can read and write to it:
set myFileHandler = myFile.CreateTextFile("C:\myText.txt") -
Step 3
Write to the file. Now that the text file is created, you can write text to it. The following code writes one line to the file:
myFileHandler.WriteLine("A line of text for a new file.") -
Step 4
Close the file. The operating system creates a lock on the file, so no other application or process can access it. It's important to close the file, so it can be used later in the application.
myFileHandler.Close











