Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening a CSV file

I am using VBA to open a CSV file. The file has a column with
part numbers which are all numeric but some start with 0.
I have placed double-quotes around the data but it still
importing it into Excel with the leading zero missing.
How do I get it to import with the leading zero still there?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening a CSV file

Hi,
Even though the part number may be only numbers, you still
want to treat it as text. The column into which you are
loading that value is treating it as a number by default
and drops the leading zero. You need to format that
column either on the worksheet or in code to a string
format, then the leading 0 will remain.

Carol

-----Original Message-----
I am using VBA to open a CSV file. The file has a column

with
part numbers which are all numeric but some start with 0.
I have placed double-quotes around the data but it still
importing it into Excel with the leading zero missing.
How do I get it to import with the leading zero still

there?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening a CSV file

Rename the file as .Txt and use the Text import wizard to mark the column
(last dialog) as Text.

You can turn on the macro recorder and get the settings so you don't have to
go through the wizard each time, however the file has to be named .txt - if
it is .csv, most versions of Excel will ignore your settings.

--
Regards,
Tom Ogilvy

ptrowe wrote in message
...
I am using VBA to open a CSV file. The file has a column with
part numbers which are all numeric but some start with 0.
I have placed double-quotes around the data but it still
importing it into Excel with the leading zero missing.
How do I get it to import with the leading zero still there?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
opening a file in Excel starts application but dose not open file Bob Shelton Excel Discussion (Misc queries) 1 July 2nd 08 07:51 PM
Opening file in Excel 2003 opens multipule instances of same file Ed_B Excel Discussion (Misc queries) 1 June 21st 07 07:10 PM
File:1 and File:2 -- Double Files when Opening One File dallin Excel Discussion (Misc queries) 1 January 25th 07 02:53 AM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. Tim Marsden Charts and Charting in Excel 2 October 15th 05 02:10 PM


All times are GMT +1. The time now is 05:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"