Article ID: 185990
Article Last Modified on 7/1/2004
Public Sub DeallocCollection(colSource as Collection)
Dim lIndex as Long
Dim lMax as Long
lMax = colSource.Count
ReDim aryLocal(lMax) as object
For lIndex = 1 to lMax
if isObject(colSource.index(1)) then _
Set aryLocal(lIndex) = colSource.index(1)
colSource.Remove(1)
Next
set colSource = nothing
For lIndex = lMax to 1 step -1
set aryLocal(lIndex) = Nothing
Next
End Sub
The performance improvement depends upon the level of fragmentation in the
collection.
Additional query words: kbDSupport kbdss VBKBObj kbVBp400 kbVBp500 kbVBp600 kbVBp
Keywords: kbhowto KB185990