Kenneth Ismert
kismert at gmail.com
Tue Feb 16 11:28:03 CST 2010
> > Heenan, Lambert: > I concur. Way not as it is so little effort. Now if VB/VBA had garbage > collection the point would be moot. But then that puts you in .NET land. > But VBA does have garbage collection -- it is reference-counter garbage collection. When the number of references to an object reaches 0, the object is destroyed. That's why setting object references to nothing is good practice -- you are indicating at the soonest possible moment when resources taken by objects may be freed. Of course, VBA de-references your object variables once the routine you defined them in exits, so in practice you can be fairly sloppy. The only problems are global objects, and objects that have circular references - A points to B, and B points to A. A and B will never be garbage collected while the program runs, thus the need for explicit de-referencing. -Ken