Unimatrix_001
asked on
Accessing collection element.
Hi there,
***********************
Dim fso As Object
Dim fld As Object
Dim subfs As Object
Dim subf As Object
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
Set fld = fso.GetFolder(path)
Set subfs = fld.SubFolders
Set subf = subfs.Item(2)
***********************
I get an error on the last line, "Invalid procedure call or argument"...
***********************
Dim fso As Object
Dim fld As Object
Dim subfs As Object
Dim subf As Object
Set fso = CreateObject("Scripting.Fi
Set fld = fso.GetFolder(path)
Set subfs = fld.SubFolders
Set subf = subfs.Item(2)
***********************
I get an error on the last line, "Invalid procedure call or argument"...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Without knowing the key name, not that I know of.
I agree with you, it seems kind of dumb that you can't get it by index and having to know the key name to reference the object (why else would you be iterationg through in the first place, if not to get the name!).
I agree with you, it seems kind of dumb that you can't get it by index and having to know the key name to reference the object (why else would you be iterationg through in the first place, if not to get the name!).
ASKER
angelIII: Could you expand on that please, are those methods I can use etc... ?
ASKER
"Without knowing the key name, not that I know of."
Hmm, okay. Although yes, seems incredibly silly not getting an element by index!
Hmm, okay. Although yes, seems incredibly silly not getting an element by index!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mrdany: Thanks, although what I'm after is:
"is there a tidy way to do it without a for loop?"
Although, I'll wait for AngelIII to reply, and then I'll probably split the points. :)
"is there a tidy way to do it without a for loop?"
Although, I'll wait for AngelIII to reply, and then I'll probably split the points. :)
>"is there a tidy way to do it without a for loop?"
no.
no.
sorry unimatrix, i didnt read the comments.. i just read the main question and answered...
my bad!!
my bad!!
ASKER
Hrm, okay... Thanks any everybody for your contributions. Points split. :)
ASKER
mrdany: Np mate. ;)
ASKER