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: 3
Default Adding Name object to a collection does not add an object

Excel 2000.


I am writing a macro to process Names. As I go through the processing,
I want to add various names to a Collection. After processing the
Names, I want to iterate over the Collection of Names I made, and
delete them. But it is not working, because the Name objects are not
added to the Collection, only a string copy of the name of the Name.
This is definitely not what the documentation says should happen.

so the code looks like this:


dim tmpName as Name
dim myCollection as new Collection

for each tmpName in activeSheet.names
if <... then
... processing (I am adding a new Name based on the the name of
some existing Names)
... myCollection.add(tmpName) 'to keep track of names I want to
delete
end if

next tmpName

dim myObj 'variant
for each myObj in myCollection
myObj.delete
next myObj

BUT the collection does not collect Name objects! It collects strings
(the name of the Name). So therefore the delete does not work.

So I don't understand: tmpName is a Name according to the debugger, but
when it is added to the Collection, it gets converted to a string
representation of the name of the Name. Therefore the Collection is
useless.

 
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
Need Help with Set Object = Collection(index) Trip[_3_] Excel Programming 1 October 19th 05 03:41 PM
Collection Object, 255 item limitation timothy[_2_] Excel Programming 4 September 11th 05 09:43 PM
Problems returning Collection object McManCSU[_23_] Excel Programming 4 August 9th 05 07:02 PM
Collection Object Keys Todd Huttenstine Excel Programming 10 October 29th 04 01:14 PM
CombBox - Object of What Collection? George Excel Programming 7 February 10th 04 12:01 AM


All times are GMT +1. The time now is 08:54 PM.

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"