Adding Data to Files

  To add data to text files:

  1. Using the OpenTextFile method of the fso object or the OpenAsTextStream method of the file object, open a file.

  2. Using the Write, WriteLine, or WriteBlankLines methods of the TextStream object, write data to the file:

    • Write—Without a trailing newline character

    • WriteLine—With a trailing newline character

    • WriteBlankLines—With one or more blank lines

  3. Using the Close method of the TextStream object, close the file.

Note:

The newline character contains a character or characters (depending on the operating system) that advances the cursor to the beginning of the next line. The ends of some lines may include non-printing characters; in such cases, the newline character may duplicate an existing character or characters.