View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
MattM
 
Posts: n/a
Default Stop Excel from stripping out leading zeros when saving as CSV

Both - many thanks for the information. I'm now finding that using the import
wizard followed by "Save As CSV" causes Excel to convert the comma-separated
text file into a tab-separated CSV file (!) which is equally frustrating.
Still, you're right - it doesn't strip out the leading zeros and I should be
able to find some workarounds with a bit more experimentation.

I'm also toying with the idea of writing a macro which adds leading zeros
preceeded by an apostrophe to all the cells in a given column, which might
prove fruitful.

Thanks again,
MattM

What he was saying was that the problem was when you read the original .CSV
file into Excel. If you rename the original file to .TXT then you can
specify the cell formats as text when you read the file in, but if you
merely read a .CSV file into Excel, it will make its own mind up on the cell
format and you'll get the problem you reported.
--
David Biddulph