Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Number formats in CSV files

I have a little confusion with number formats in CSV files created
/processed in VB. Using a custom number format 00000 I get numbers such as
00392 to display OK when in an xls file and when saved as a CSV file these
numbers display OK immediatley before saving then using a text editor on the
file they appear to be OK in the saved file. However when the CSV file is
reopened in excel the number format is lost and appears as 392 rather than
00392. This also happens when the number is input as '00392 rather than
just using the custom format..

Can you explain what is happening here and what do you think external
systems will do with these numbers? Is there any way to maintain the 00000
formats?

Mervyn


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Number formats in CSV files

Hi Thomas,

I do not know what your "external Systems" are, however, usually when
importing data you can define the datatype of every field (this would be
alphanumeric or text in your case). When you import what is 00123 in your
csv-file (viewed with notepad) as just 123 then Excel "guesses" that it is a
number, like when you type into a cell 000123 which will also give you just
123.

Now, one solution would be instead of "opening" the csv-file, make a
"text-import", and there you can define the field as text (Menu Data/import
external Data/Import Data, first set the file type to "csv, txt..." and
select your file, then you can specify the separator as ";" and then you
have options for each field).

Best regards

arno

"Mervyn Thomas" schrieb im Newsbeitrag
...
I have a little confusion with number formats in CSV files created
/processed in VB. Using a custom number format 00000 I get numbers such

as
00392 to display OK when in an xls file and when saved as a CSV file these
numbers display OK immediatley before saving then using a text editor on

the
file they appear to be OK in the saved file. However when the CSV file is
reopened in excel the number format is lost and appears as 392 rather than
00392. This also happens when the number is input as '00392 rather than
just using the custom format..

Can you explain what is happening here and what do you think external
systems will do with these numbers? Is there any way to maintain the 00000
formats?

Mervyn




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Number formats in CSV files

Have you tried putting dittos (") around each field..
eg. "00392"
-----Original Message-----
I have a little confusion with number formats in CSV

files created
/processed in VB. Using a custom number format 00000 I

get numbers such as
00392 to display OK when in an xls file and when saved as

a CSV file these
numbers display OK immediatley before saving then using a

text editor on the
file they appear to be OK in the saved file. However when

the CSV file is
reopened in excel the number format is lost and appears

as 392 rather than
00392. This also happens when the number is input

as '00392 rather than
just using the custom format..

Can you explain what is happening here and what do you

think external
systems will do with these numbers? Is there any way to

maintain the 00000
formats?

Mervyn


.

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
Defualt number formats When Opening CSV Files christopher.bowers Excel Discussion (Misc queries) 5 September 16th 08 04:57 PM
Saving files in two different formats at the same time Andy31313 Excel Discussion (Misc queries) 1 May 18th 07 09:54 PM
Converting file formats into .xls files Shawna Excel Discussion (Misc queries) 2 January 18th 07 07:45 PM
importing csv files, problem with date formats jiwolf Excel Worksheet Functions 5 March 7th 06 12:48 AM
Maintaining formats of files Craig Excel Discussion (Misc queries) 1 January 12th 05 12:15 AM


All times are GMT +1. The time now is 12:10 PM.

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

About Us

"It's about Microsoft Excel"