Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

deletring a line of text from a text file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leo - 16 Feb 2005 19:09 GMT
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
Tom Lake - 16 Feb 2005 19:23 GMT
> Hello all,
>
[quoted text clipped - 3 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.