So I am importing dates from a computer generated CSV file. In the CSV file, the dates are in the dd/mm/yyyy hh:mm format. However when I import it using VBA, VBA reads it as mm/dd/yyyy hh:mm. so VBA reads 01/05/2015 (1st of may) as 5th of jan.
I checked, and the CSV file is definietly in the dd/mm/yyyy hh:mm format.
any help in fixing this would be greatly appreciated.
So when I open the CSV file manually, the date is in the dd/mm/yyyy hh:mm format. Like 1st of december 2016 would be 01/12/2016 1:00. But when VBA opens it, it changes to 12/01/2016 1:00.
This is the entire code in question. Its nothing complex, and I cant figure out whats wrong with it.
Sub import()
Dim calbook As Workbook
Dim newwb As Workbook
Dim destiwb As Workbook
Dim directory As String
Dim Filename As String
directory = "C:\Users\winterco\Desktop\"
Set calbook = Workbooks("Data_totaliser1.xlsm")
Filename = Dir(directory & "*.CSV")
Set newwb = Workbooks.Add
Set destiwb = ActiveWorkbook
Do While Filename <> ""
Workbooks.OpenText (directory & Filename)
Call Sort_Data(Filename, destiwb, directory, calbook)
Filename = Dir()
Loop
End Sub