Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting the record from an Array String

Status
Not open for further replies.

jessiejane

Programmer
Oct 29, 2009
32
US
I have a text file in the format of "Name-Date"

Sample of the text file:

John-02/03/2010
Mary-05/20/2010

When the date meets the 60 day counter then the record should be deleted from the text file and any spaces in the text file should be removed.

(I have converted the text file from array to string format for other reasons so I am spliting the text file)

strData = objFSO.OpenTextFile(Path & strFile, 1).ReadAll
'Split the text file into lines
arrLines = Split(strData,vbCrLf)
For Each strLine in arrLines
DateValue = Mid(strLine,instr(strLine, "-")+1)
Days = DateDiff("d", CDate(DateValue), todayDate)
if Days >=60
' How would I delete the record from a file'
?????????????????????????????????????? and remove
blank lines.
end if

Any help is appreciated.


 
Write all the lines you do want to a new array (or file), skip the lines you don't want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top