thank you.
I have found solution which is not working for me.
Sub tableComparator()
Dim rst1, rst2, cmd, conn, esteLibro, wbActive, sSql
Set conn = CreateObject("ADODB.Connection")
Set rst1 = CreateObject("ADODB.RecordSet")
Set rst2 = CreateObject("ADODB.RecordSet")
wbActive = ActiveWorkbook.FullName
sSql = "select * from [t_test$]"
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source='" & wbActive & "';" & _
"Extended Properties=""Excel 12.0;HDR=Yes;"";"
Set rst1 = CreateObject("ADODB.RecordSet")
rst1.Open sSql, oConn, adOpenStatic, adLockReadOnly
End Sub
so here:
sSql = "select * from [t_test$]"
is not working.
Do you have similar issue?
macro is from here:
https://stackoverflow.com/questions/...an-excel-sheet
What is working for me is:
With Range("t_test")
tblAddress = "[" & .Parent.name & "$" & .Address(False, False) & "]"
End With
sSql = "select * from " & tblAddress
so can i refer to tablename (listobject name)?
Or only to named range?
Or only to address?
Best,
Jacek
Bookmarks