PDA

View Full Version : Trying to return value deep within the Locals window



ashleyuk1984
07-27-2015, 10:03 AM
Hi,
I'm basically trying to return a value from the Locals window. I'm getting there, but I just can't seem to get the last step correct.

This is what my Locals window looks like.

http://i.imgur.com/gWekTHL.png

I'm trying to grab information from this block of information.

(I've crossed out all of the confidental stuff)

I can grab the information highlighted below (01. January) by just using this:

Debug.Print queue.Item(1).Name

http://i.imgur.com/H98eokT.png

However, I'm trying to go a little bit deeper.
I'm trying to return this value.

http://i.imgur.com/7cqxZuH.png

I've tried several combinations, and also the obvious one (to me anyway) which was:


Debug.Print queue.Item(1).SubFolders.Item(1).Name

But that doesn't appear to work. I'm getting error "Run-time error 5: Invalid procedure call or argument"
I can't seem to grab that information of "2601"

Please help.
Thanks

ashleyuk1984
07-29-2015, 08:38 AM
I'm afraid I'm still no further with this? And I can't seem to find anything on Google... I'm probably not searching the correct keywords?
Does anyone have any ideas how to overcome this?

Thank You

Aflatoon
07-29-2015, 09:17 AM
The folders are only indexed by name. You have to iterate using For Each.

ashleyuk1984
07-29-2015, 02:42 PM
Hmm, is there no way to specifically call that value "2601" mentioned above?

I would have thought something like this would work...

Debug.Print queue.Item(1).SubFolders.Item(1).Name
But sadly it doesn't :(

jonh
07-29-2015, 11:27 PM
queue.subfolders("2601")

Aflatoon
07-31-2015, 02:15 AM
Typically you would use a For Each loop - how do you know that 2601 is the only folder you are interested in?

mancubus
07-31-2015, 02:34 AM
imo, seeing your code and knowing your ultimate goal may help helpers suggest alternative solutions...

p45cal
07-31-2015, 05:14 AM
Long shot but try

Debug.Print queue.Item(1).SubFolders(1).Name

Or
Debug.Print queue(1).SubFolders(1).Name
Will test this later.

edit after trying:
Althoug queue(1) instead of queue.Item(1) works, it seems you can't gain access to a Subfolder by index (Aflatoon was right). However you could put the subfolders ito a collection (as you may already have done; how did you create the queue collection of folders?)

Paul_Hossler
07-31-2015, 06:43 AM
Maybe ...



Debug.Print queue.Items(1).SubFolders.Items(1).Name



Hmmm - I tried to highlight the 's' in 'Items( )'