AW: textdatei zeile löschen
11.01.2008 13:32:00
Rudi
Hallo,
ungetestet:
Sub Schreiben()
Dim strTxt As String, intK As Integer
Const strTextDatei As String = "c:\test\Test.txt"
strTxt = InputBox("Text?")
If strTxt "" Then
intK = FreeFile
Open strTextDatei For Append As #intK
Print #intK, strTxt
Close intK
End If
End Sub
Sub Loeschen()
Dim strTxt As String, intK As Integer, arrTmp(), iTmp As Long, strTmp As String
Const strTextDatei As String = "c:\test\Test.txt"
strTxt = InputBox("Text?")
If strTxt "" Then
intK = FreeFile
Open strTextDatei For Input As #intK
Do While Not EOF(intK)
Line Input #intK, strTmp
If strTmp strTxt Then
iTmp = iTmp + 1
ReDim Preserve arrTmp(iTmp)
arrTmp(iTmp) = strTmp
strTmp = ""
End If
Loop
Close #intK
Open strTextDatei For Output As #intK
For iTmp = 1 To iTmp
Print #intK, arrTmp(iTmp)
Next
Close intK
End If
End Sub
Gruß
Rudi
Eine Kuh macht Muh, viele Kühe machen Mühe