Question : Code to open a .csv file, edit and save

I am looking for some simple code either as a DOS batch file or as VB code using Excel which will open a csv file (sample attached) , remove leading zeros from the numbers in the second field in each row, then save it as a csv file.  The leading zeros are not displayed in Excel, but are when the file is opened in Textpad or Wordpad.

While the sample file only contains 2 rows, the files can contain hundreds of rows so the procedure needs to loop through each row until it reaches a blank row.

Apreciate your assistance

Thanks

Answer : Code to open a .csv file, edit and save

A batch file could do that (amonsgst other things such as an excel macro).  Tr this:

@Echo off
setlocal enabledelayedexpansion
del outfile.csv 2>NUL
REM NETWORK,000123,E,BEP,125.00,$,1
for /f "tokens=1-7 delims=," %%a in ('type RESPNET.csv') do (
  set /A id=1%%b - 1000000
  if not "%%c%%d%%e"=="" echo echo %%a,!id!,%%c,%%d,%%e,%%f,%%g >> outfile.csv
)
notepad outfile.csv
Random Solutions  
 
programming4us programming4us