PC Review


Reply
Thread Tools Rate Thread

delete element is collection

 
 
Gary Keramidas
Guest
Posts: n/a
 
      14th Nov 2007
how would i remove all elements from a variable set as new collection?

erase expects an array.

--


Gary



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      14th Nov 2007
Set your collection to nothing and then re-create it...

Dim col As Collection

Set col = New Collection
col.Add Sheet1, Sheet1.Name
col.Add Sheet2, Sheet2.Name
col.Add Sheet3, Sheet3.Name

MsgBox col.Item(Sheet2.Name).Name
Set col = Nothing
Set col = New Collection

--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

> how would i remove all elements from a variable set as new collection?
>
> erase expects an array.
>
> --
>
>
> Gary
>
>
>
>

 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      14th Nov 2007

thanks jim, works for me.
--


Gary


"Jim Thomlinson" <James_Thomlinson@owfg-Re-Move-This-.com> wrote in message
news:7F8F81CD-68E5-4F55-ADA4-(E-Mail Removed)...
> Set your collection to nothing and then re-create it...
>
> Dim col As Collection
>
> Set col = New Collection
> col.Add Sheet1, Sheet1.Name
> col.Add Sheet2, Sheet2.Name
> col.Add Sheet3, Sheet3.Name
>
> MsgBox col.Item(Sheet2.Name).Name
> Set col = Nothing
> Set col = New Collection
>
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Gary Keramidas" wrote:
>
>> how would i remove all elements from a variable set as new collection?
>>
>> erase expects an array.
>>
>> --
>>
>>
>> Gary
>>
>>
>>
>>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      14th Nov 2007
Set the collection variable to Nothing. E.g.,

Set MyCollection = Nothing


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Gary Keramidas" <GKeramidasATmsn.com> wrote in message
news:(E-Mail Removed)...
> how would i remove all elements from a variable set as new collection?
>
> erase expects an array.
>
> --
>
>
> Gary
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete element of collection being iterated Michal Januszczyk Microsoft Dot NET 3 8th Sep 2006 05:19 PM
configuration element and collection Andrzej Kaczmarczyk Microsoft C# .NET 1 12th Dec 2005 03:49 PM
collection doesn't find element =?Utf-8?B?c29yaW5jb20=?= Microsoft Dot NET 1 11th Aug 2005 03:31 PM
Remove an element while enumerating through a collection Edward Diener Microsoft Dot NET Framework 5 12th Feb 2005 10:49 AM
Swap element in Controls Collection? Perlith Microsoft Access Reports 0 29th Oct 2003 10:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:27 PM.