Hallo,
wie lösche ich Zeilen aus einer Textdatei? Ich möchte alle Zeilen, die zwischen "# Write Values" und "# End Write" stehen, aus meiner Textdatei löschen.
Wie mache ich das?
Danke für jede Hilfe!
Grüße Andi
' ********************************************************************** ' Modul: Modul1 Typ: Allgemeines Modul ' **********************************************************************
OptionExplicit
PrivateSub RemoveLinesFromTextfile() Dim strFile As String, strTempFile As String, strPath AsString Dim FF1 AsInteger Dim FF2 AsInteger Dim strLine AsString Dim bWrite As Boolean, bMark AsBoolean
OnErrorGoTo err_Handler
strPath = "F:\Temp\"' Pfad zur Datei - Anpassen!
strFile = "test.txt"' Textdatei - Anpassen!
If Right(strPath, 1) <> "\"Then strPath = strPath & "\"
Hi,
danke für die schnelle und super Hilfe!!!
Einfach genial!
Grüße Andi
Noch eine Frage...
14.05.2006 10:46:25
andS
...wie kann ich verhindern, dass auch "# Write Values" und "# End Write" gelöscht wird?
Brauche das um wieder zu schreiben, bzw. erneut zu löschen.
Es wäre sehr nett, wenn du mir nochmals helfen könntest.
Grüße Andi
AW: Noch eine Frage...
14.05.2006 11:00:14
Josef
Hallo Andi!
Dann so.
' ********************************************************************** ' Modul: Modul1 Typ: Allgemeines Modul ' **********************************************************************
OptionExplicit
PrivateSub RemoveLinesFromTextfile() Dim strFile As String, strTempFile As String, strPath AsString Dim FF1 AsInteger Dim FF2 AsInteger Dim strLine AsString Dim bWrite As Boolean, bMark AsBoolean
OnErrorGoTo err_Handler
strPath = "F:\Temp\"' Pfad zur Datei - Anpassen!
strFile = "test.txt"' Textdatei - Anpassen!
If Right(strPath, 1) <> "\"Then strPath = strPath & "\"