Excel/VBA Date Format Problems

I am currently attempting to open a CSV file using VBA however when the CSV file is opened using the following code....

    CSVFile = Application.GetOpenFilename("", , "CSV Import File")
    Application.DefaultFilePath = origDefPath
   
    If CSVFile = "" Then
   
    Else
   
    Set SageWorkbook = Application.Workbooks.Open(CSVFile)

One column contains invoice date information and on certain rows the date format is alterting to MM-DD-YYYY while other remain DD-MM-YYYY.  If I open the file manually the dates are fine.

Please can anyone advise
DamozzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rory ArchibaldConnect With a Mentor Commented:
Have you tried using Workbooks.OpenText instead of WOrkbooks.Open and specifying the Local:=True parameter?
0
 
dev00790Commented:
What are the date formats in the CSV file?
0
All Courses

From novice to tech pro — start learning today.