Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel CSV Import - Not seeing Date and formating it

Status
Not open for further replies.

Lurb

IS-IT--Management
Feb 21, 2003
8
0
0
GB
Hello,

In code I am opening a CSV file with a date in - excel XP is then formatting the date as general and not as date.

I have used the Exactly the same code and csv files on Excel 97 and Excel 2000 with no problems.

Any ideas why it isn't picking it up as a date?

Regards
Lurb
 
Have you tried the macro recorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The macro recorder doesn't help.

I have tracked it down to the fact Excel XP has a locale selector for the date format selector when formatting cells. If I set Office to US then it works fine but when it is set to UK it reads the CSV as a US date and finds the 28/6/04 as an invalid date.

I don't know how to get around it, but this is the problem.

Any ideas how to get around this?

Regards
Lurb
 
Set the whole lot of dates to text and convert AFTER getting them into excel - either thyat or convert csv to tab delimited and use the text import wizard to specify the date format

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top