View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Day & Month reversed when importing text

Terry,
This has been a contentious issue since Vista when the default date format
switched from mm/dd/yyyy to dd/mm/yyyy. My approach to importing delimited text
files is to 'dump' the file contents into an array so I can setup number
formats to suit the template the data will get 'dumped' into.

Unfortunately, Excel uses default formats when importing csv/tsv/txt files and
so inaccurate data results. What's important about importing from these sources
is that they are created as expected by the host template. This breaks when the
file has been created in XP (for example) because date formats don't align with
Vista & later OSs.

Possible Solutions:
Format date columns before importing the data via Excel's Import feature;
Read the data into an array via VBA, then either...
format the date data;
format the target date cols;
..before dumping the data into the sheet/template.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion