I am just trying to read the first line in a textfile, make some decisions, then re-write the file with the NEW string. But it tells me Bad File Mode on the line in red. Why?
Thanks
Code:For i = 0 To UBound(arrTheRamFiles) lblStatus.Caption = "Reading " & arrTheRamFiles(i) Set objTextStream = objFso.OpenTextFile(arrTheRamFiles(i)) If Not objTextStream.AtEndOfStream Then strWhatIsInTheRAMFile = objTextStream.ReadLine ' indicates no ?parameters at the end of the string If LCase(Mid(strWhatIsInTheRAMFile, Len(strWhatIsInTheRAMFile), 1)) = "m" Then strWhatIsInTheRAMFile = strWhatIsInTheRAMFile & strTheExtraStuff Else If InStr(1, LCase(strWhatIsInTheRAMFile), "author") = 0 Then ' add author= strWhatIsInTheRAMFile = strWhatIsInTheRAMFile & "&author=""Coral Ridge Ministries""" End If End If objTextStream.WriteLine strWhatIsInTheRAMFile End If Set objTextStream = Nothing Next




Reply With Quote