PaulBarter
MIS
Using Excel 2000
I am writing a macro that will open a selected .csv file and extract the data I want into the current spreadsheet.
The problem is that the dates in the .csv file get formated incorrectly.
All the dates in the file are in the format "dd/mm/yy" (including the quotes). If the file contains "25/11/05" then it converts to 25th November correctly, however if it contains "04/11/05" then it converts to 11th April 2005 (i.e. it assumed the first number is month if <= 12. How do I get it to treat the first 2 digits as day regardless.
It seems that if I manually open the .csv file then it reads it in correctly, however if a macro use a .Open method (or even .OpenText method) then it fails as above.
It seems the the .csv suffix is causing the problem as if I rename the file with .txt suffix and use the .OpenText method then all is OK.
Any ideas.
I am writing a macro that will open a selected .csv file and extract the data I want into the current spreadsheet.
The problem is that the dates in the .csv file get formated incorrectly.
All the dates in the file are in the format "dd/mm/yy" (including the quotes). If the file contains "25/11/05" then it converts to 25th November correctly, however if it contains "04/11/05" then it converts to 11th April 2005 (i.e. it assumed the first number is month if <= 12. How do I get it to treat the first 2 digits as day regardless.
It seems that if I manually open the .csv file then it reads it in correctly, however if a macro use a .Open method (or even .OpenText method) then it fails as above.
It seems the the .csv suffix is causing the problem as if I rename the file with .txt suffix and use the .OpenText method then all is OK.
Any ideas.