LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Do I need to destroy a collection I made when I am done with it?

I have some code that intializes a new collection, runs code using the
collection and then ends. Do I need to destroy the collection so it doesn't
take up memory or does this automatically happen when the procedure is over?
Is there a way to see what is in memory?
Option Explicit

Private Sub cboMounting_Change()

Dim colPoleSpecsAll As Collection
Dim colPoleSpecsData As Collection
Dim ctrl As Control

Set colPoleSpecsAll = New Collection
With colPoleSpecsAll
.Add lblPoles
.Add cboPoles
.Add lblShape
.Add cboShape
.Add lblFieldPoleSize
.Add cboFieldPoleSize
End With

Set colPoleSpecsData = New Collection
With colPoleSpecsData
.Add cboPoles
.Add cboShape
.Add cboFieldPoleSize
End With


If cboMounting.ListIndex 1 Then
For Each ctrl In colPoleSpecsAll
ctrl.Enabled = True
Next ctrl
For Each ctrl In colPoleSpecsData
ctrl.BackColor = vbWindowBackground
Next ctrl
Else
For Each ctrl In colPoleSpecsAll
ctrl.Enabled = False
Next ctrl
For Each ctrl In colPoleSpecsData
ctrl.BackColor = vbButtonFace
Next ctrl
End If

End Sub

--
Cheers,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you destroy a specific object or collection? pinkfloydfan Excel Programming 2 February 25th 07 09:43 AM
Search & Destroy Ben H Excel Programming 2 July 26th 06 06:57 PM
Search and destroy Pugwyrm Excel Programming 4 February 14th 05 03:13 PM
How to make VBA code to self-destroy itself? count Excel Programming 6 November 10th 04 05:11 PM
Seek and destroy [email protected] Excel Programming 7 December 3rd 03 08:41 PM


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"