Write to file

Back to VBScript Function WriteData(strLine) Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, MyFile, FileName, TextLine, RootDir Set fso = CreateObject("Scripting.FileSystemObject") datDateTime = now strFileDateTime = year(datDateTime) & right("0" & month(datDateTime), 2) & right("0" & day(datDateTime), 2) & right("0" & hour(datDateTime), 2) & right("0" & minute(datDateTime), 2) ' Open the file for output. RootDir = "D:\" FileName = RootDir & strFileDateTime & ".tmp" Set MyFile = fso.OpenTextFile(FileName, ForAppending, True) ' Write to the file. MyFile.WriteLine strLine MyFile.Close End Function 'WriteData