MichaelRSnow
Active Member
- Joined
- Aug 3, 2010
- Messages
- 409
Hi, I have this code (see below) that edits an XML file but it overrides the changes on the original file, I've tried to add a SaveAs option without any luck? Does anyone know how this can be achieved wit the below code?
Code:
oFile = DUnRefindedXML
'Create FileSystemObject for reading file content
Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = FSO.OpenTextFile(oFile, 1)
Do Until f.AtEndOfStream = True
strLine = f.ReadLine
strFind = ">"
strRep = ">" & vbNewLine
strLine = Replace(strLine, strFind, strRep)
NewStrLine = NewStrLine & strLine
Loop
f.Close
Set f = Nothing
'Create FileSystemObject for writing file content
Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = FSO.OpenTextFile(oFile, 2)
f.Write NewStrLine
f.Close
Set f = Nothing