I want to retrieve data from a closed workbook. My code is
fileName = "the path\test.xlsx"
With CreateObject("ADODB.Connection")
.CommandTimeout = 500
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" _
& fileName & ";" & "Extended Properties=""Excel 12.0;HDR=YES;Readonly=true"";"
.Open
ThisWorkbooks.Worksheets("new").Range("A1").CopyFromRecordset .Execute("select * from [source$B1]")
.Close
End With
I have some error, 424:object required, object doesn't found... I think it is a syntax problem. The purpose is to retrieve data from cells and put in the other sheet/workbook thanks for your help