Error ADO Connection Macro Excell
Tengo un marco en excel que ya estaba funcionando pero hace unos días mi computadora realizo algunas actualizaciones y ahora me aparece este error
Private Sub Worksheet_Change(ByVal Target As Range) Dim KeyCells As Range Set KeyCells = Range("C1") If Not Application.Intersect(KeyCells, Range(Target.Address)) _ Is Nothing Then ' Inicia codigo para las recuperaciones Application.ScreenUpdating = False Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim sql As String Dim x As Long, y As Long, i As Long, SQL_Rec As String For i = 1 To 50 Set cnn = New ADODB.Connection Set rst = New ADODB.Recordset If Left(Cells(i + 1, 1).Value, 1) = "Z" Or Left(Cells(i + 1, 1).Value, 1) = "T" Then sql = "Select sum(total) as Total From TBL_Rep_Prin Where Ncut ='" & Cells(i + 1, 1).Value & "' and area_resp = 'Piel' and status = 'entregado' and semana = '" & Cells(1, 3).Value & "'" 'MsgBox sql With cnn .Provider = "Microsoft.ACE.OLEDB.12.0" .ConnectionString = "data source= \\matfile\data\shared\Databases\ Recuperaciones\Recuperaciones.accdb" .Open End With With rst .CursorLocation = adUseClient .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open sql, cnn, , , adCmdText End With rst.MoveFirst Cells(i + 1, 6).Value = rst("total") rst.MoveNext Set rst = Nothing Set cnn = Nothing Else End If Next i ' Termina codigo de Recuperaciones Application. ScreenUpdating = True MsgBox "Updated", vbInformation End If End Sub
Estas son las librerias que tengo cargadas.
1 respuesta
Respuesta de Abraham Valencia
1