Actualizar una hoja de Excel usando VBA / ADO

Cuando ejecuto esta función, aparece un error de tiempo de ejecución, "La operación debe usar una consulta actualizable". ¿Qué lo está causando?

Function updateConfigFile(strQuery As String)

Dim cnn As ADODB.Connection         
Dim objMyCmd As ADODB.Command

Set cnn = New ADODB.Connection
Set objMyCmd = New ADODB.Command

constConfigFile = "MyWorkbookName"

With cnn

    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & ActiveWorkbook.Path & constConfigFile & ";" & _
        "Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
    .Open

End With

strQuery = "update [test$] Set [test]='Hello' WHERE [Test]='h'"

objMyCmd.CommandType = adCmdText
objMyCmd.CommandText = strQuery
objMyCmd.ActiveConnection = cnn

objMyCmd.Execute


Set objMyCmd = Nothing
Set cnn = Nothing


End Function

Respuestas a la pregunta(1)

Su respuesta a la pregunta