-
Deleting from a file!
Hey what's up, i was just wondering if i can lets say remove just one specific line from a txt file. so lets say its like this
"Bla", "Ble", "Blue"
"Pel", "Mel", "Melll"
lets say i want to remove just the "Bla","Ble","Blue" from lets say a file calle Check.dat, is there a way i can do that, or no :). Thx your your help again.
-
The way I've done something like this in the past is to open the file and then open a second, new file. Read every line from the original into the second, new file except for the line you want to delete. You then Kill the original file and rename (Name) the new file as the original.
Greg
-
Try this thread:
http://www.vbforums.com/showthread.p...hreadid=135822
I found it by doing a search with the key "remove one line"
-
Thank!
Thank you. Wow alot harder then i thought. :)
-
strText = "Delete lines containing this text"
Open "TextFile.txt" For Input As #1
Open "NewFile.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, strTemp1
If InStr(1,strTemp1,strText) = 0 Then Print #2, strTemp1
Loop
Close #1,#2
Kill "TextFile.txt"
Name "NewFile.txt" As "TextFile.txt"