Delete first line From CSV file from excel

J

JA

I am modifying a csv file from VBA and am adding a line to the beginning of
file which is working well. However, I'd like to delete teh first line of
the csv file before adding the line.

I have many files so it is not efficient to open them from excel. I'd like
to use the VBA Put, Print, Write statements etc.
 
R

Rick Rothstein \(MVP - VB\)

I presume you are using the code that RB Smissaert posted in response to
your "how do I add a line" request. If so, add this line immediately after
you load the file into the FileContents variable (that is, make the
following the next line after the **first** Close #hFile statement...

FileContents = Mid$(FileContents, InStr(FileContents, vbCrLf) + 2)

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top