baitmaster
Well-known Member
- Joined
- Mar 12, 2009
- Messages
- 2,042
Good afternoon all
I'm using the following code to create an ADO recordset from a tab-delimited text file:
I'm expecting to see the data appear on sheet 1, delimited across multiple cells. Instead the data is concatenating into column 1 only. This is a test only, as I'm trying to create recordsets on which I can perform various SQL commands purely from the text file. Can anyone suggest why I'm not getting multiple columns in my recordset?
Thanks
I'm using the following code to create an ADO recordset from a tab-delimited text file:
Code:
Sub LoadFile()
Dim connCSV As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
Dim path As String: path = ThisWorkbook.path & "\"
connCSV.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & ";Extended Properties=""text;HDR=yes;FMT=Delimited"""
rsTest.Open "Select * From ReportDataSmall.txt", connCSV, adOpenStatic, adLockReadOnly, adCmdText
Sheet1.Cells(1, 1).CopyFromRecordset rsTest
End Sub
I'm expecting to see the data appear on sheet 1, delimited across multiple cells. Instead the data is concatenating into column 1 only. This is a test only, as I'm trying to create recordsets on which I can perform various SQL commands purely from the text file. Can anyone suggest why I'm not getting multiple columns in my recordset?
Thanks