ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date format when opening a .CSV file programmatically (https://www.excelbanter.com/excel-programming/281698-date-format-when-opening-csv-file-programmatically.html)

jason

Date format when opening a .CSV file programmatically
 
have a date 05/11/2003 in a cell in a csv file
if I open the file manually it reads 05/11/2003
if I open the file via vba it reads 11/05/2003

(if I right click on the cell in all three above cases the format is
the same Custom - "dd/mm/yyyy")

Any ideas

Jason

Angus Comber[_2_]

Date format when opening a .CSV file programmatically
 
What Regional Setting is your computer set to?

dd/mm/yyyy is not US format. Possibly default VBA format used for date is
US? Just a guess.

Angus Comber

"jason" wrote in message
om...
have a date 05/11/2003 in a cell in a csv file
if I open the file manually it reads 05/11/2003
if I open the file via vba it reads 11/05/2003

(if I right click on the cell in all three above cases the format is
the same Custom - "dd/mm/yyyy")

Any ideas

Jason




jason

Date in a .CSV file - IS THIS A BUG??
 
Angus,

Have you tried this?!!!
I've just trued this at home and it looks almost like a bug!
Typed 05/11/2003 in A1 and saved it as a csv file.
Closed the file and opened it again manually - still 05/11/2003.
Opened another workbook and recorded a macro of opening the csv file.
Gone back to the recorded macro and run it - now it is 11/05/2003 !!!
(still 05/11/2003 when manually opened)
Regional settings are set to dd/MM/YYYY.

Help.
Jason.


"Angus Comber" wrote in message ...
What Regional Setting is your computer set to?

dd/mm/yyyy is not US format. Possibly default VBA format used for date is
US? Just a guess.

Angus Comber

"jason" wrote in message
om...
have a date 05/11/2003 in a cell in a csv file
if I open the file manually it reads 05/11/2003
if I open the file via vba it reads 11/05/2003

(if I right click on the cell in all three above cases the format is
the same Custom - "dd/mm/yyyy")

Any ideas

Jason


BrianB

Date in a .CSV file - IS THIS A BUG??
 
If you try anything with dates in macros you will find that they
default to the american mm/dd/yy and need to be re-formatted.

Regards
BrianB
===========================================




(jason) wrote in message . com...
Angus,

Have you tried this?!!!
I've just trued this at home and it looks almost like a bug!
Typed 05/11/2003 in A1 and saved it as a csv file.
Closed the file and opened it again manually - still 05/11/2003.
Opened another workbook and recorded a macro of opening the csv file.
Gone back to the recorded macro and run it - now it is 11/05/2003 !!!
(still 05/11/2003 when manually opened)
Regional settings are set to dd/MM/YYYY.

Help.
Jason.


"Angus Comber" wrote in message ...
What Regional Setting is your computer set to?

dd/mm/yyyy is not US format. Possibly default VBA format used for date is
US? Just a guess.

Angus Comber

"jason" wrote in message
om...
have a date 05/11/2003 in a cell in a csv file
if I open the file manually it reads 05/11/2003
if I open the file via vba it reads 11/05/2003

(if I right click on the cell in all three above cases the format is
the same Custom - "dd/mm/yyyy")

Any ideas

Jason



All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com