Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Dropping Leading Zeroes
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Dropping Leading Zeroes
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Dropping Leading Zeroes
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 . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Dropping Leading Zeroes
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 . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Dropping Leading Zeroes
Correct about numeric is treated as a number.
-- Regards, Tom Ogilvy "Robert" wrote in message ... 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 . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Leading Zero dropping off after export to Excel | Excel Discussion (Misc queries) | |||
Leading Zeroes | Excel Discussion (Misc queries) | |||
Converting xls to CSV file - dropping leading 0s | Excel Discussion (Misc queries) | |||
spreadsheet dropping leading zeroes when exporting from SQL Serve. | Excel Worksheet Functions | |||
CSV leading zeroes | Excel Discussion (Misc queries) |