Hi,
I've been trying to get this working:
VB Code:
Dim iFreeFile1 As Integer, iFreeFile2 As Integer, varData As String, s As String iFreeFile1 = FreeFile Open App.Path & "\_SettingsDump.dat" For Input As #iFreeFile1 iFreeFile2 = FreeFile Open sFile For Output As #iFreeFile2 Do While Not EOF(iFreeFile1) Line Input #iFreeFile1, varData s = varData ' I'll add the replace later Print #iFreeFile2, s Loop Close #iFreeFile2 Close #iFreeFile1
I want to open a file, replace all instances of a string with another, and save it to another file. I wrote the above code, but the resultant file was just full of rubbish (loads of those square character things). So I took the replace function out and it still produces the same thing.
If I replace the Print #iFreeFile2, s line with Print #iFreeFile2, "a" & s then it works fine, only has the "a" at the start of each line.:confused:
I cant see why this shouldnt work, and why adding a character for the Print function suddenly makes it work.:confused: What am I doing wrong?
