Hi,
I have a .txt log file. From my script I want to add a new line that contains date, hour and location of backup.
I've tried with ForAppending and it works. But I want that the last information to be on top so, descending data.
My procedure is the following:
Sub LogFile(FileLoc)
Dim objFile, ts,SearchString, SearchChar
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Set objFile = fso.GetFile("LogFile.txt")
Set ts = objFile.OpenAsTextStream(ForReading, TristateUseDefault)
MsgBox Mid(ts,Instr(1, ts, "#", 1))
ts.WriteLine(" "& date & " " & time & " " & FileLoc)
ts.Close
End Sub
In my text file I have '#' sign after that is my util information
I've tried to isolate the util text and then edit. At the line with MsgBox I get the message "Object doesn't support this property or method".
How can I solve my problem ?
I have a .txt log file. From my script I want to add a new line that contains date, hour and location of backup.
I've tried with ForAppending and it works. But I want that the last information to be on top so, descending data.
My procedure is the following:
Sub LogFile(FileLoc)
Dim objFile, ts,SearchString, SearchChar
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Set objFile = fso.GetFile("LogFile.txt")
Set ts = objFile.OpenAsTextStream(ForReading, TristateUseDefault)
MsgBox Mid(ts,Instr(1, ts, "#", 1))
ts.WriteLine(" "& date & " " & time & " " & FileLoc)
ts.Close
End Sub
In my text file I have '#' sign after that is my util information
I've tried to isolate the util text and then edit. At the line with MsgBox I get the message "Object doesn't support this property or method".
How can I solve my problem ?