LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Adding Name object to a collection does not add an object

"as just the name"
would be better as:
"as just the VALUE"
(not name)

Dave Peterson wrote:

The parenthesis makes excel want to "evaluate" what's inside them. And that
means that tmpname gets passed as just the name (tmpname.value which would
evaluate to something like: =sheet1!$a$1).

So in one case (with the parens) you're passing a bunch of strings to the
collection. In the other (without the parens), you're passing real name
objects--and all their properties.

Kind of close to the difference between

Dim myVal As Variant 'not range!
myval = activesheet.range("a1:a10")
'or
set myval = activesheet.range("a1:a10")

The top creates a 10 row by 1 column array of values.
The bottom assigns a range object to A1:A10. And all those properties are still
available.

(kind of...)

Tim Richardson wrote:

Dave Peterson wrote:
Drop the ()'s around the (TmpName) in the .add line and it'll work ok.


thanks. That worked. But why does this fail:
"myCollection.Add (tmpName) "

and why does this work?
myCollection.Add tmpName


--

Dave Peterson


--

Dave Peterson


 
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 12:14 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"