Thread: File handling
View Single Post
 
Old June 7th, 2006, 01:30 AM
Raghavendra_Mudugal Raghavendra_Mudugal is offline
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

okay GOTCHA !!!

check this new line of code

Private Sub Command1_Click()
Dim fso As FileSystemObject
Dim tsA As TextStream
Dim tsB As TextStream

Set fso = New FileSystemObject
Set tsA = fso.OpenTextFile(App.Path & "\a.txt", ForReading)
Set tsB = fso.OpenTextFile(App.Path & "\b.txt", ForWriting, True)

While Not tsA.AtEndOfStream
    s = tsA.ReadLine
    Rem NEW CODE
    If Mid$(s, 1, 2) = "04" Then
        Rem OLD CODE s1 = Replace(s, "eee", "")
        s2 = Left(s, Len(s) - 3)
        tsB.WriteLine (s2)
    Else
        tsB.WriteLine (s)
    End If
Wend

tsA.Close
tsB.Close
Set fso = Nothing

MsgBox "Done"
End Sub

I guess, this code make some sense to your requirement?

hope this helps.


With Regards,
Raghavendra Mudugal