Hey Guys
Im trying to replace some text in a file. But when I use the Replace method it deletes a large portion of the file even though Im not using the Start argument here is the code
dim fso, gf, f, rtf, gtf
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("strngtext.txt", 1)
rtf = f.ReadAll
f.Close
Set gf = fspenTextFile("MultiUseDev.txt", 1)
gtf = gf.ReadLine
gf.Close
On Error Resume Next
Set NewRepos = ""
dstrContents = Replace(gtf,rtf,NewRepos)
Set xf = fspenTextFile("MultiUseDev.txt", 2)
xf.Write dstrContents
xf.Close
Im trying to replace some text in a file. But when I use the Replace method it deletes a large portion of the file even though Im not using the Start argument here is the code
dim fso, gf, f, rtf, gtf
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("strngtext.txt", 1)
rtf = f.ReadAll
f.Close
Set gf = fspenTextFile("MultiUseDev.txt", 1)
gtf = gf.ReadLine
gf.Close
On Error Resume Next
Set NewRepos = ""
dstrContents = Replace(gtf,rtf,NewRepos)
Set xf = fspenTextFile("MultiUseDev.txt", 2)
xf.Write dstrContents
xf.Close