Set xlWB = Nothing/Set xlApp = Nothing

foolios

New Member
Joined
Aug 4, 2011
Messages
21
I have been reading comments about programs needing to release memory after they are finished. I saw an article at:
http://www.tushar-mehta.com/excel/vba/xl_doesnt_quit/

That discusses using these methods when closing a workbook.
Code:
    Set xlWB = Nothing     Set xlApp = Nothing</pre>

I do not know what version of Excel they may be writing about but I am wanting to know if these are still practical for all Excel workbooks(2007/2010)?

Should I also set all my variables to nothing as well as I near the end of code execution?

Thanks for any tips on how to release memory this way, or if this practice is no longer necessary.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
IMO, there are some arcane cases where it is necessary, but in general, VBA releases all variables when they go out of scope, and it is unnecessary clutter to do it explicitly.
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top