How to delete rows in a csv file?
Why can't I simply open the csv files as an Excel application, delete the
rows, close the file, then open it again as a text file for appending?
I tried this but I think the syntax is wrong:
Dim XL, XLBook
Set XL = CreateObject("Excel.application")
Set XLBook = XL.Workbooks.Open("MyFile.csv")
Rows("1:3").Entirerow.delete <<<Type mismatch error for "Rows" happens
on this line
"D.P. Roberts" wrote in message
...
I have a vbscript that appends data to a csv file on a daily basis. When
new data gets appended to the bottom rows of the file, I'd like the oldest
data in the top rows to be deleted. Does anyone know how I can delete the
top 3 rows every time the file gets appended? Here's what I've got so far:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set fsoOut = CreateObject("scripting.filesystemobject")
Set outFile = fsoOut.OpenTextFile("MyFile.csv", ForAppending, True)
<<<Here's where I want to delete rows 1-3 in the csv file
outFile.writeline (Now & "," & DataValue)
outFile.close
Thanks for any help on this...
|