I have a sub routine that opens and closes another Excel workbook as part of a loop - for say 100 iterations. I'm running into a problem with "bloat" in the Excel application. Closing the workbook doesn't seem to free-up the memory - i monitor it on the "process" tab of the Windows Task Manager.
How can i force Excel to free up this memory? I've tried "Set wkbWorkbook = Nothing" inside the loop after each wkbWorkbook.close statement but this doesn't seem to work.
Is there something i'm not thinking of? The simple routine below also creates this issue for me. Excel memory steadily increases until the system crashes.
Sub MakeExcelBloat()
Dim wkb As Workbook
Do Until 1 = 2
Set wkb = Workbooks.Open("C:\Big Ugly Excel File.xls")
wkb.Close
Loop
End Sub
How can i force Excel to free up this memory? I've tried "Set wkbWorkbook = Nothing" inside the loop after each wkbWorkbook.close statement but this doesn't seem to work.
Is there something i'm not thinking of? The simple routine below also creates this issue for me. Excel memory steadily increases until the system crashes.
Sub MakeExcelBloat()
Dim wkb As Workbook
Do Until 1 = 2
Set wkb = Workbooks.Open("C:\Big Ugly Excel File.xls")
wkb.Close
Loop
End Sub