Mình có đoạn code này khi chạy trên excel 2010 thì chạy bình thường nhưng khi chạy trên excel 2003 thì bị lỗi "Provider cannot be found. It may not be properly installed". Nhờ các anh chị xử lý giúp em làm sao để có thể chạy trên excel 2003 được à. Em xin cám ơn 



Sub doichieuketoan()
Application.ScreenUpdating = False
Range("A6:G" & Range("A65000").End(3).Row + 1).ClearContents
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\ketoan.xls;Extended Properties=""Excel 12.0 Xml;HDR=NO;IMEX=1"";"
Range("A6").CopyFromRecordset cn.Execute("SELECT f5,f7,f8,f15,f22,f30 FROM [doc1$A15:AK60000] where f2 >0")
Range("A6:A" & Range("A65000").End(3).Row).Value = "=row()-5"
Range("A6:G" & Range("A65000").End(3).Row).Borders.LineStyle = xlContinuous
Range("A6:G60000").Select
ActiveWorkbook.Worksheets("B07").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("B07").Sort.SortFields.Add Key:=Range( _
"C6:C60000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("B07").Sort.SortFields.Add Key:=Range( _
"B6:B60000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("B07").Sort
.SetRange Range("A5:G60000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
File đính kèm
Lần chỉnh sửa cuối: