View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Calmack Calmack is offline
external usenet poster
 
Posts: 2
Default Date conversion on text file import

I've solved the problem. Just needed to add English (United States) format
to my regional settings. I've now got the language bar to appear on my
taskbar, though I do not need to change settings now as Excel is
automatically recognising the US format.

"Jim Rech" wrote:

I flipped to UK settings and got exactly your issue with a text file in US
format when manually opening the file. But with a macro it came in fine.

Workbooks.OpenText Filename:="c:\datetime.txt", DataType:=xlDelimited,
Tab:=True

This is because, when a macro is running, Excel is in 'US settings mode'
despite your local settings. So it reads the US format file correctly.

--
Jim
"Calmack" wrote in message
...
|I am in the UK and I am trying to import a tab-delimited text file which
| contains all dates in US date-time format, eg 03/14/2008 9:12:25 AM. I
| import the file into Excel and it goes through the wizard. I set the date
| field to MDY, but when I press Finish the dates appear either as a UK date
| (when both month and day are less than/equal 12) or as text (when it
cannot
| convert). I have tried it by editing the text file and separating date
and
| time with tabs before importing and that works. But I don't want to have
to
| do editing like that.