How to open a file for write

Hello,
I am trying to create a file and add content to it dynamically but no luck.
I can open a file for read using:

ForReading = 1;
fs = new ActiveXObject(“Scripting.FileSystemObject”);
a = fs.OpenTextFile(SUBMISSIONFILE, ForReading);

When I try to use the same with a different value (tried 2 & 0) it doesn’t work.

Thanks for your help

I think that if the file doesn’t exist you need to pass in “true” for the optional “create” parameter, ie

var ForWriting = 2;
a = fs.OpenTextFile(SUBMISSIONFILE, ForWriting, true);

Hth.

It worked. Thanks for your help.
Where can I find help about the functions supported? I tried to use 2 but didn’t know I should have another parameter. I even created the file manually but I guess I needed a third parameter.

MSDN has some reference pages for the FileSystemObject, for instance:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/32a1c6c4-255b-4281-8bd8-213096ea1fe0.asp

To find the answer above I just googled ‘FileSystemObject OpenTextFile’. The first google link was a great summary by a third party website.

(Go google!)