The information in this article applies to:
SYMPTOMSThe Licenses Collection handles the removal of elements differently from a standard VBA Collection object when you use it in a For Each loop. In a standard VBA Collection, if an item is removed during a For Each loop, the collection recognizes that the item is no longer an element and does not attempt to iterate over that element. In the Licenses collection, if an item is removed or the collection is cleared, the For...Each loop still iterates over that element of the collection. It does not recognize any changes made to the collection during the loop. RESOLUTIONDo not attempt to access the members of the Licenses Collection in the same loop in which you are removing elements of the collection. Remove the unwanted licenses using the Clear or Remove methods before iterating over the collection in a For...Each loop. If you need to use a loop when removing elements, use two separate loops: one to remove the elements and one to access the remaining elements. See step 4 in the MORE INFORMATION section of this article for an example. STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce Behavior
Additional query words:
Keywords : kbnokeyword kbVBp600 kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |