I have written a code that finds all files starting with a specific name and reads data from them, there is usually 1k files or more in the folder, I wrote a little benchmark and realize that my code reads approx 1 file per second and that is a lot of time. I am pretty new to VBA, and I was wondering if I took a wrong approach to this? Function Code:
Function ReadDataFromWorksheet()
Dim XL As Excel.Application
Dim WBK As Excel.Workbook
Dim i As Integer
i = 1
Set XL = CreateObject("Excel.Application")
Do While i < (ArraySize + 1)
Set WBK = XL.Workbooks.Open("PATH TO FILE")
Array(i).Data1 = WBK.ActiveSheet.Range("F6").Value
WBK.Close SaveChanges:=False
i = i + 1
Loop
Set XL = Nothing
End Function
Sorry for my bad spelling!... and thank you in advance for the help!