[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Excel/VBA Date Format Problems

Posted on 2011-02-21
2
Medium Priority
?
351 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 2000 total points
ID: 34942841
Have you tried using Workbooks.OpenText instead of WOrkbooks.Open and specifying the Local:=True parameter?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

834 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