VBA - Close workbook after acquiring necessary information
<p>Your assistance is required on solving this world (Excel VBA) problem.
I am using a VBA to populate an immense workbook (500 Cells per row), from a bucket load of workbooks(Qty=96).
The VBA I am using got created by [@Kevin][1] and it works for about 20 files until my pc runs out of memory and crashes Excel.
This kind of works great for working with such an immense amount of cells per workbook, because opening and closing each workbook adds up to the process quite a lot. Opening each work book and copy all 500 cells and close, then proceed with the next one and so on x ±96 times, but that would be more complicated than just making this one work, if you have any of the 2 solutions please help! </p>

<p>Here is the VBA I am using:</p>



<pre><code>Function GetField(Path As String, WorksheetName As String, CellRange As String) As Variant

Dim wb As Workbook
Dim ws As Worksheet
Dim rng As Range

Set wb = GetObject(Path)
Set ws = wb.Worksheets(WorksheetName)
Set rng = ws.Range(CellRange)

GetField = rng.Value

wb.close 

End Function
</code></pre>