CarlRostron
Registered User.
- Local time
- Today, 09:00
- Joined
- Nov 14, 2011
- Messages
- 88
I am trying to use a Connection to an xlsx spredsheet to read in a table of information (the data is not a table, just laid out in a table, see attached, the one I am trying to load is xlsx not xls but I cannot for some reson upload the xlsx one on here)
I have the following declared:
my connection string is:
i open the connection which works fine:
Now here I hit the problem, I have the following SQL string:
The spreadsheet contains just 1 tab, named table so I think I am referring to the data correctly in my SQL string?
When I open the recordet for variable rs using:
I get the error dialogue box:
The Microsoft Access database engine could not find the object 'table$'. make sure the object exists and that you spell its name and the path name correctly.....
Any ideas on where this could be going wrong?
I did a Debug.print to check the strConnectionString was correct and the Source is exactly correct and refers to the name of the file I am trying to access exactly.
Please help.
I have the following declared:
Code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
my connection string is:
Code:
strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & cstrFolder & Chr(92) & tempSymbol & ".xlsx;Extended Properties='Excel 12.0 Xml;HDR=YES';"
i open the connection which works fine:
Code:
cn.Open strConnectionString
Now here I hit the problem, I have the following SQL string:
Code:
strSelect = "SELECT * from [table$]"
The spreadsheet contains just 1 tab, named table so I think I am referring to the data correctly in my SQL string?
When I open the recordet for variable rs using:
Code:
rs.Open strSelect, cn, adOpenStatic, adLockOptimistic, adCmdText
I get the error dialogue box:
The Microsoft Access database engine could not find the object 'table$'. make sure the object exists and that you spell its name and the path name correctly.....
Any ideas on where this could be going wrong?
I did a Debug.print to check the strConnectionString was correct and the Source is exactly correct and refers to the name of the file I am trying to access exactly.
Please help.
Attachments
Last edited: