View Single Post
 
Old 07-02-2020, 10:35 PM
zhanguoru zhanguoru is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2020
Posts: 1
zhanguoru is on a distinguished road
Default how to update record of activeworkbook in ADO

how to update record of activeworkbook in ADO?

I use the code for the below,but it can not success. thanks

StrCon1 = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties ='Excel 8.0;HDR=YES;';Data Source='" & ActiveWorkbook.FullName & "'"

Con1.ConnectionString = StrCon1
Con1.Open

tkSQL = "SELECT * FROM[List$]"

Rst1.Open tkSQL, Con1, adOpenStatic, adLockOptimistic

Debug.Print Rst1.RecordCount
Do Until Rst1.EOF
Rst1("Status").Value = "OK"
Rst1.MoveNext
Loop

Rst1.Close
Con1.Close
ThisWorkbook.Save
Reply With Quote