View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Robert[_25_] Robert[_25_] is offline
external usenet poster
 
Posts: 2
Default Import Dropping Leading Zeroes

I guess my real question is this:

There are two fields in the import file. One is "00234"
and the other is "00401UCS". The second field does not
drop the leading zeroes but the first one does.

They both go into the same column on the worksheet. This
column is defined as general. I would think that any field
that is enclosed with quotes would be assumed to be text.

But it appears that even though there are quotes around
the field, if the field is all numeric, it is assumed to
be numeric.

-----Original Message-----
So use the opentext method and define your columns to

meet your
expectations. If the file is named with a .csv

extension, then you will
have to rename it to .txt (as an example) before opening

it with opentext or
your settings will be ignored.

You can get a good start by turning on the macro

recorder, then doing
File=Open and walking through the text import wizard.

The macro recorder
will record your settings as arguments to OpenText.

If the file format will be different each time, then you

are back to what I
originally suggested. Naturally, you will then have to

change the way you
open the file.

--
Regards,
Tom Ogilvy

"Robert" wrote in message
...
I am using the command:

Workbooks.Open FileToOpen, Format:=2

and not the import wizard.

Robert

-----Original Message-----
in the text import wizard, in the last dialog,

designate
that column as Text

--
Regards,
Tom Ogilvy

"Robert" wrote in

message
...
I am importing a comma delimited text file into an

Excel
worksheet using Excel 97. Even though a field is
represented in the text file as "000234" (i.e. a text
field), it shows in the worksheet as 234.

How can I prevent the leading zeroes from being

dropped?

Thanks


.



.