Cleaning house with the VBA.Collection
Posted on 2007-08-10
I have a VBA program in Excel that makes fairly extensive use of the VBA.Collection object. The I have a function that returns a collection object, and whenever I want to build a new one, I simply set the collection variable to the collection returned by the function, using a new set of parameters in the function.
When I point the collection object to a new collection, what happens to the memory that was allocated for the old one?
Should I be removing all the items from the collection before building a new one?
If the collection members are themselves large objects, do I need to set the members to Nothing before removing them?
If the collection does not clean up after itself, am I correct in assuming that new build competes for a diminishing memory pool?