Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Data differs when opening an .csv file manually and through VBA

  Asked By: Sean    Date: Jan 11    Category: MS Office    Views: 1053
  

When i open an .csv workbook manually by double clicking on it the data
in cell A2 = "2/07/2007"

but when i open the same workbook using below code

Workbooks.Open Filename:="...\a.csv", updatelinks:=No, ReadOnly:=Yes

the data changes to "7/02/2007"

Note : the data in cell A2 in .csv is date and format = *14/03/2001

I donno why this is happening? Does anybody know.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Lula Woods     Answered On: Jan 11

You can see it's a date  format issue - your months and days (7 and 2) are
reversed between the two techniques.

You need to either play with your default Regional and Language Options in
Control Panel or set the formats explicitly after the Workbooks.Open call.
Which one is coming out correctly - the Workbooks.Open call or the
double-click?

 




Tagged: