M
Mike YO_BEE B
I have a text file that contains about 8 to 10 text sequences that I need to
replace.
I want to search and replace all 8 to 10 text sequence anytime I run this
script
Here is what I have so far.
Const ForReading = 1
Const ForWriting = 2
strHostFile = "C:\summat.dii"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strHostFile, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "@EDOC", "@C DocLink ")
strNewText = Replace(strText, "@C BegDoc", "@C BegDoc#")
'etc............
Set objFile = objFSO.OpenTextFile(strHostFile, ForWriting)
objFile.WriteLine strNewText
objFile.Close
The only text that is replaced it the last strNewText
i.e strNewText = Replace(strText, "@C BegDoc", "@C BegDoc#")
I am a novice at scripting so please be kind.
Could I use arrOldTexts = array("@EDOC", "@C BegDoc", etc......)
For Each strtexts in arrOldTexts
replace.
I want to search and replace all 8 to 10 text sequence anytime I run this
script
Here is what I have so far.
Const ForReading = 1
Const ForWriting = 2
strHostFile = "C:\summat.dii"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strHostFile, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "@EDOC", "@C DocLink ")
strNewText = Replace(strText, "@C BegDoc", "@C BegDoc#")
'etc............
Set objFile = objFSO.OpenTextFile(strHostFile, ForWriting)
objFile.WriteLine strNewText
objFile.Close
The only text that is replaced it the last strNewText
i.e strNewText = Replace(strText, "@C BegDoc", "@C BegDoc#")
I am a novice at scripting so please be kind.
Could I use arrOldTexts = array("@EDOC", "@C BegDoc", etc......)
For Each strtexts in arrOldTexts