How do you only delete certain parts/lines/sentences in a text file?
Printable View
How do you only delete certain parts/lines/sentences in a text file?
Hi larzi,
Take a look here
It's a useful site to do with string manipulation.
About half way down the page is:
Delete a substring from a string
Hope this helps :)
Thanks for that, that'll help alot. I'll rate you as a good helper :D
Your welcome :)
Thanks for the rating.
If you get stuck, post back here.
If it's sorted out then mark this thread Resolved, using the 'Thread Tool' menu option above please.
I usually import text files into a text box and do my editing that way. It is easier (at least I think) and does not require a whole lot of code (which is always good. :D )
Okay, so how do you do that?
Make sure the textbox is set to multline and you have scroll barsvb Code:
'Replace 'c:\larzi.txt' with the file you want to load to the TextBox Open "c:\larzi.txt" For Input As #1 Text1.Text = Input(LOF(1), #1) Close #1 'to save it back to your text file, first, delete the existing one Kill "c:\larzi.txt" 'now create a new one Open "c:\larzi.txt" For Append As #1 Print #1, Text1.Text Close #1 End Sub
Thanks