I am new to VB Scripting and have written a small script. The one area I am having a problem is when I want to add text to the last text line in a text file, not have the text added as a new line. For example if my text file contains.
This is line 1
When the script runs, I want the text that the script adds to the file to be added on to the last line of text in the file.
This is line 1. This is the new text that was added.
Instead I am getting
This is line 1.
This is the new text that was added.
The code I am using is:
dim filesys, filetxt
Const ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys1.OpenTextFile("c:\somefile2.txt", ForAppending, True)
filetxt.WriteLine ("and restored at " & Time() & ".")
Any help of suggestions would be appreciated.