hi, bjotorres
Here simple code that I wrote.
Maybe it'll help you.
Here simple code that I wrote.
Code:
'path to file from which text will be copied
fromPath = "c:\from.txt"
'path to file where text should be replaced
toPath = "c:\to.txt"
textThatShouldBeReplaced = "some text to search"
'create File System Object to perform manipulations with files
Set fso = CreateObject("Scripting.FileSystemObject")
'Open text file for reading, copy text from it and close it
Set from_file = fso.OpenTextFile(fromPath, 1)
copiedText = from_file.ReadAll
from_file.Close
'Open text file for writing, replace text in it and close it
Set to_file = fso.OpenTextFile(toPath, 1)
fileText = to_file.ReadAll
to_file.Close
fileText = Replace(fileText, textThatShouldBeReplaced, copiedText, 1, -1, 1)
Set to_file = fso.OpenTextFile(toPath, 2)
to_file.Write fileText
to_file.Close