Z
zSplash
I am having difficulties trying to replace the text of a file using the
"opentextfile" method. Whether I try opening the file with the write
property, or use the alternative "openastextstream" method, I get an error.
Once I've "captured" theText2 (which I want to insert as the text for
x6005.dat file), how do I do that?
Here's my code -- everything works just fine 'til I try to replace my
theText2 into the file.
Sub changeQuotes()
Dim theText As String, theText2 As String
Dim x As Integer, Y As Integer, FSO As Object
Dim myPath As String, myFSO As Object, myText As String
myPath = "c:\windows\x6005.dat"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set myFSO = FSpentextfile(myPath, 1, True)
' Set myFSO = FSpenastextstream(myPath, 2)
myText = crthFSO.readall
myFSO.Close
theText = myText
theText2 = Replace(theText, """", "in.")
'now, put this new string in x6005.dat
Set myFSO = FSpentextfile(myPath, 2, True)
myFSO = theText2
myFSO.Close
Set myFSO = FSpenastextstream(myPath, 2)
End Function
TIA
"opentextfile" method. Whether I try opening the file with the write
property, or use the alternative "openastextstream" method, I get an error.
Once I've "captured" theText2 (which I want to insert as the text for
x6005.dat file), how do I do that?
Here's my code -- everything works just fine 'til I try to replace my
theText2 into the file.
Sub changeQuotes()
Dim theText As String, theText2 As String
Dim x As Integer, Y As Integer, FSO As Object
Dim myPath As String, myFSO As Object, myText As String
myPath = "c:\windows\x6005.dat"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set myFSO = FSpentextfile(myPath, 1, True)
' Set myFSO = FSpenastextstream(myPath, 2)
myText = crthFSO.readall
myFSO.Close
theText = myText
theText2 = Replace(theText, """", "in.")
'now, put this new string in x6005.dat
Set myFSO = FSpentextfile(myPath, 2, True)
myFSO = theText2
myFSO.Close
Set myFSO = FSpenastextstream(myPath, 2)
End Function
TIA