by Gary Wisniewski - Spider Eye Studios
First, I am tempted to ask why the VBA designers didn't design a good collection class to begin with. You know, the VBA Collection class SUCKS. It's sort of like wondering why we still are using COMMAND.COM and can only put one filename on the delete command. Right?
But, let's not ask that question. Let's merely assume that they had a good, competent, perhaps even brilliant and inspired vision and that the Collection class is a, perhaps enigmatic, instance of that vision.
George Raudabaugh's ASP "Collection class workaround" is, alas, not always usable in complex cases. Consider, for example, developing a wrapper. Do you put it in each DLL if you have several? Do you put it in its own DLL? The former causes big problems (one DLL can't very easily declare and use them when it has not only its own, but a foreign wrapper to cope with). The latter seems risque, or even brash.
Suffice it to say that, systems programmer that I am, developing a stand-alone VB DLL which implements a Collection class as its sole purpose seems, at a minimum, an abuse of power. At best, one can offer few bon mots for such a design. In addition, there are some hidden "gotchas" in the way a VB app exports things like _NewEnum and you really can't, exactly, precisely - to my satisfaction at least - get it right.
After much time spent wrestling the forementioned problems to the ground, and having now about 8 DLLs which work on various Websites, I decided on a better solution.
FlexBag has now been born. It is a 100% compatible replacement for the VBA collection class (with surgical, search-and-replace drop-inishness). But, it is a 25K stand-alone DLL which depends upon nothing (no MFC, no OLEAUTO). It is lean, mean, and has much spiffier array management internally. It will probably even run under OLE 2.0, who knows. It also supports sparse matrices, choice of case-insensitve comparsions, cloning, and has such exotic features as a "Clear" method, which VBA Collections amazingly don't have (do you get the COMMAND.COM analogy?).
It also uses ATL, and is very, very tight C++ code.
I was careful to make sure this thing won't rev incompatibly, and I promise I will do my damnedest to make sure it's not vulnerable to upgrades from any of the product teams at You Know Where.
Look here for more details... it's free!