I have some macros that I have setup to continuously run under Excel 2007. Among other things, the macros connect to a webpage and import data from there, also import data from local HTML files and from other workbooks. The macros run 24/7, unattended, on a dedicated machine. Now everything works fine, EXCEPT:
After about 18 hours of running, Excel takes up about 800-1000 MB in memory. I assume this is because of incorrect/incomplete memory release when macro ends. thing is, I don't know how to make sure memory is released when macro ends. I added code to delete data conections and unused worksheets, but it did not help at all.
The macros:
At startup, clear all worksheets of all data already present
1. Connect to the webpage and get data from there (every time macro runs)
2. Connect to a local HTML file and get data from there (once a day)
3. Generate some reports out of the imported data in 4 worksheets
4. Generate charts from the data in the reports
5. Save the charts as HTML files
6. Delete the worksheets containing the charts
Theoretically, there shouldn't be any increase in memory occupied, but there is. Any idea of how to improve things so memory is properly released?
One more thing: The memory is released if i simply maximize Excel and minimize it back, without needing to stop the macros or close the file. So I am assuming some weird "keep it all in the cache" Windows idea! Anyway, I need a tip of how to achieve this automatically, without needing to get into the prod machine every day and maximize/minimize Excel...
After about 18 hours of running, Excel takes up about 800-1000 MB in memory. I assume this is because of incorrect/incomplete memory release when macro ends. thing is, I don't know how to make sure memory is released when macro ends. I added code to delete data conections and unused worksheets, but it did not help at all.
The macros:
At startup, clear all worksheets of all data already present
1. Connect to the webpage and get data from there (every time macro runs)
2. Connect to a local HTML file and get data from there (once a day)
3. Generate some reports out of the imported data in 4 worksheets
4. Generate charts from the data in the reports
5. Save the charts as HTML files
6. Delete the worksheets containing the charts
Theoretically, there shouldn't be any increase in memory occupied, but there is. Any idea of how to improve things so memory is properly released?
One more thing: The memory is released if i simply maximize Excel and minimize it back, without needing to stop the macros or close the file. So I am assuming some weird "keep it all in the cache" Windows idea! Anyway, I need a tip of how to achieve this automatically, without needing to get into the prod machine every day and maximize/minimize Excel...