Solved

Excel/VBA Date Format Problems

Posted on 2011-02-21
2
297 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now