PC Review


Reply
Thread Tools Rate Thread

deletring a line of text from a text file

 
 
Leo
Guest
Posts: n/a
 
      16th Feb 2005
Hello all,

I need to read a text file and delete the first line of text found then save
it and close it (from either vb or vba)

I cannot seem to find info on deleting lines from a text file anywhere. If
anyone has any code or links or suggestions I'd appreciate it very much

thank you


 
Reply With Quote
 
 
 
 
Tom Lake
Guest
Posts: n/a
 
      16th Feb 2005
> Hello all,
>
> I need to read a text file and delete the first line of text found then

save
> it and close it (from either vb or vba)
>
> I cannot seem to find info on deleting lines from a text file anywhere. If
> anyone has any code or links or suggestions I'd appreciate it very much


What you have to do is to

Open the original file for input
Open a new file for output.
Read a line from the original file.
Check to see if this is a line you want to delete. If it is, then skip the
next step.
Write the line to the new output file.
Go back to see if there are more lines in the original file to be read. If
not, do the following steps
Close both files, KILL the original file (or rename it - much safer)
Rename the new file to the original file's old name.

Done.

Tom Lake


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store/read listbox items in a text file line by line (with line break) ? kimiraikkonen Microsoft VB .NET 6 2nd Nov 2007 05:27 PM
Preserving Line breaks when importing text into multi line text boxes. One Handed Man [ OHM ] Microsoft Access 3 15th Sep 2003 04:15 PM
Preserving Line breaks when importing text into multi line text boxes. One Handed Man [ OHM ] Microsoft Access Form Coding 1 15th Sep 2003 04:15 PM
Preserving Line breaks when importing text into multi line text boxes. One Handed Man [ OHM ] Microsoft Access External Data 3 15th Sep 2003 04:15 PM
Preserving Line breaks when importing text into multi line text boxes. One Handed Man [ OHM ] Microsoft Access Queries 1 15th Sep 2003 04:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:11 PM.