Puoi anche fare una replace globale senza ciclare ogni riga:
codice:
Option Explicit
CONST ForReading = 1
CONST ForWriting = 2
dim fso, ws, ts, path, strTemp
path="C:\Documents and Settings\xxxxxx\Desktop\test.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(path, ForReading)
If Not ts.AtEndOfStream Then
strTemp = Replace(ts.ReadAll, VbCrLf & VbCrLf, VbCrLf)
Set ws = fso.OpenTextFile(path, ForWriting, True)
ws.Write(strTemp)
End If
ws.close: set ws = nothing
ts.close: set ts = nothing
set fso = nothing
Questo ovviamente se devi SEMPRE sostituire il doppio accapo con uno singolo. In caso tu debba sostituirne N consecutivi con uno solo puoi optare per una regular expression.