
Originally Posted by
assafbe
...using the "replace" function won't help here...
It really depends how you use it:
Code:
Private Sub Command1_Click()
Dim fileNum As Integer
Dim sText As String
Dim arLines() As String
Dim iPos As Long
Dim i As Long
fileNum = FreeFile()
Open "c:\test.txt" For Input As #fileNum
sText = Input(LOF(fileNum), #fileNum)
Close #fileNum
arLines() = Split(sText, vbNewLine)
For i = 0 To UBound(arLines)
iPos = InStr(InStr(1, arLines(i), "~") + 1, arLines(i), "~")
arLines(i) = VBA.Left$(arLines(i), iPos - 1) & Replace(arLines(i), "~", "-", iPos, 1)
'''Debug.Print arLines(i)
Next i
sText = Join(arLines(), vbNewLine)
fileNum = FreeFile()
Open "c:\test.txt" For Output As #fileNum
Print #fileNum, sText
Close #fileNum
End Sub