Hi VBForums,
I have the following code which finds and replaces a string in a specified text file.
I need the code to find and replace a string in multiple text files. I've looked into using the following code but I don't know how to overwrite the text file which is been read.Code:Dim FSO, InputFile, OutputFile Dim s As String FSO = CreateObject("Scripting.FileSystemObject") InputFile = FSO.OpenTextFile("c:\File.txt", 1) s = InputFile.ReadAll s = Replace(s, TextBox1.Text, TextBox2.Text) OutputFile = FSO.CreateTextFile("c:\File.txt", True) OutputFile.Write(s)
Any thoughts?Code:InputFile = FSO.OpenTextFile("c:\File.txt", 1)
Thanks,
Sebkeh


Reply With Quote
< Please
if this helped you out. Any kind of thanks is gladly appreciated > 
