P
pie
Please tell me,the VBA code to import *.dbf to active worksheet i
excel.
Now I use "QueryTable", this code(below), to import Access fil
(*.mdb) to active worksheet.
But when I choose *.dbf file , it's not work.
'*************************************
sqlstring = "select distinct name from MXTREND"
connstring = _
"ODBC;DSN=MXTREND;UID=Rep21;PWD=NUyHwYQI;Database=MXTREND"
Worksheets(ReplaceSheet).Activate
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
Destination:=Range("A1"), Sql:=sqlstring)
.Refresh
End With
'******************************
thanks, Pi
excel.
Now I use "QueryTable", this code(below), to import Access fil
(*.mdb) to active worksheet.
But when I choose *.dbf file , it's not work.
'*************************************
sqlstring = "select distinct name from MXTREND"
connstring = _
"ODBC;DSN=MXTREND;UID=Rep21;PWD=NUyHwYQI;Database=MXTREND"
Worksheets(ReplaceSheet).Activate
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
Destination:=Range("A1"), Sql:=sqlstring)
.Refresh
End With
'******************************
thanks, Pi