I've tried to import data with following code
but it wont work. I've seen examples using OLEDB, but I can't make it work.
Code:
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array("DSN=db_name; UID=user_name; PWD=pw;"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM table")
End With
but it wont work. I've seen examples using OLEDB, but I can't make it work.