Opening CSV files causes Date Differences

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Currently we have a CSV within the file we have a date of
5th August displayed as "05/08" within the CSV file.
When we open it from excel it shows 5-AUG. But if we open
it from code it shows 8-MAY. Any ideas of how to open the
file in VBA code to show the correct date of 5-AUG

Thanks in Advance

Mark
 
VBA is very USA centric--especially with .csv files.

I think I'd rename the file to .txt and then record a macro when I opened it
once. Then make sure you choose the correct date format for each field.

Then use that macro to open subsequent files with one minor change to the
macro. I'd pause and let the user select what file is coming in:

Maybe you can use:

dim myFilename as variant
myfilename = application.getopenfilename("Text files, *.txt")
if myfilename = false then
exit sub 'user hit cancel
end if

Workbooks.OpenText Filename:=myfilename, ....rest of your code....
 
Back
Top