Date problem using ADO getting large csv files into excel



I posted this in the excel group, but not sure i'll get a response
from there.

I have some code that i've put together from various sources and
thought i had i cracked.
Unfortunately i can't get the date format to remain constant.

As i am in the UK, my system has date format of dd/mm/yy
I have found however that when running the macro using ADO, some of
the date is entered as US mm/dd/yy.
I thought that adding IMEX=1 would get around this, as i had read
that
this made the datatype text. I was hoping that it would change all
the values in the excel workbook to text and i could then alter any
formats later in code if required.


The csv files i have are huge and i split them into seperate
workbooks
for each new work*** to keep the processing time down. I noticed
that the earliest file i had referred to November 2004, but the date
seemed to be January. I need to keep the date format constant for
all
the workbooks, but am struggling with this. 15/11/04 is in my 8th
workbook, but the first one has 11/01/04.


Any help or advice greatly appreciated. I had never heard of ADO
until about a week ago, so please be gentle.


Sub HorseData()
'** requires references to Microsoft ADO Ext & Microsoft Scripting
'** will look at csv files in the "datastore" folder. This file
should be in that folder.


' The code will not look in "Excel Horse Data" folder so completed
folders can be stored
' without their csv file being seen/re-filtered by the code.


xFile = "*.csv"
1
'for each folder in currentfolder
mypath = ThisWorkbook.Path


With Application.FileSearch
' Change as applicable.
.LookIn = mypath
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True
.Filename = xFile
.Execute
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual


For i = 1 To .FoundFiles.Count
'''Workbooks.Add
Dim oConn As Object, oRS As Object, oFSObj As Object


Set oFSObj = CreateObject("SCRIPTING.FILESYSTEMOBJECT")


strFilePath =
oFSObj.getfile(.FoundFiles(i)).parentfolder.Path
strFilename = oFSObj.getfile(.FoundFiles(i)).Name


'this ensures only one level down is looked at and older data
can be stored
Dim xFolder As Scripting.Folder
Set xFolder = oFSObj.getfolder(strFilePath).parentfolder
If xFolder.Name <> "Excel Horse Data" Then


'Open an ADO connection to the folder specified
Set oConn = CreateObject("ADODB.CONNECTION")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strFilePath & ";" & _
"Extended
Properties=""text;HDR=yes;IMEX=1;FMT=Delimited"""


Set oRS = CreateObject("ADODB.RECORDSET")


'Now actually open the text file and import into Excel
oRS.Open "SELECT * FROM " & strFilename, oConn, 3, 1, 1
While Not oRS.EOF
Workbooks.Add
Sheets.Add
x = x + 1
Active***.Name = "***" & (x + 3)
Application.Calculation = xlCalculationManual
Active***.Range("A1").CopyFromRecordset oRS, 65536
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs strFilePath & "\" &
Left(strFilename, Len(strFilename) _
- 4) & "-" & x & ".xls"
ActiveWorkbook.Close
Application.DisplayAlerts = True
Wend


oRS.Close
oConn.Close
'''ActiveWorkbook.Close savechanges:=False
End If
x = 0
Application.Calculation = xlCalculationAutomatic
Next i


Application.ScreenUpdating = True
End With


If xFile <> "*.txt" Then
xFile = "*.txt"
GoTo 1
End If


End Sub


thanks
George

.