Xin giúp đỡ - ADO (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

anhdepjai

Thành viên thường trực
Tham gia
16/6/10
Bài viết
387
Được thích
94
Chào các anh chị em.

Mình muốn nhờ mọi người xem giúp đoạn code:

Set Cnn = CreateObject("ADODB.Connection")
Set lrs = CreateObject("ADODB.Recordset")
With Cnn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.1;" & _
"Data Source=" & ThisWorkbook.Path & "\data\Final.xls" & _
";Extended Properties=""Excel 8.0;HDR=No;"";"
.Open
End With
Khi mình muốn open file final.xlsm thì bị báo lôĩ "External table is not in expected format."
Mọi người hướng dẫn mình sửa lỗi với.
Thanks
 
Chào các anh chị em.

Mình muốn nhờ mọi người xem giúp đoạn code:

Set Cnn = CreateObject("ADODB.Connection")
Set lrs = CreateObject("ADODB.Recordset")
With Cnn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.1;" & _
"Data Source=" & ThisWorkbook.Path & "\data\Final.xls" & _
";Extended Properties=""Excel 8.0;HDR=No;"";"
.Open
End With
Khi mình muốn open file final.xlsm thì bị báo lôĩ "External table is not in expected format."
Mọi người hướng dẫn mình sửa lỗi với.
Thanks
Nếu file có đuôi xlsm thì bạn thử đổi
";Extended Properties=""Excel 8.0;HDR=No;"";" thành
";Extended Properties=""Excel 12.0;HDR=No;"";" xem sao (BẠn đang dùng phiên bản offiice từ 2007 trở lên thì phải)
PHP:
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & ThisWorkbook.Path & "\data\Final.xlsm" & _
";Extended Properties=""Excel 12.0;HDR=No;"";"
.Open
Hoặc bạn sửa thế này xem sao
 
Lần chỉnh sửa cuối:
Upvote 0

Bài viết mới nhất

Back
Top Bottom