Solved

Excel/VBA Date Format Problems

Posted on 2011-02-21
2
323 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:Damozz
2 Comments
 
LVL 1

Expert Comment

by:dev00790
ID: 34942754
What are the date formats in the CSV file?
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 34942841
Have you tried using Workbooks.OpenText instead of WOrkbooks.Open and specifying the Local:=True parameter?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question