Hello All,

I am trying to access a series of nested collections and getting a runtime error 5 when I do so... the nested collection is a series of folders and files assembled using the FileSystemObject.

I cannot seem to place a screenshot here but from the VB6 debugger I have a watch set on a variable called FSFolder which is defined as an object, and FSFolder has collections in it for the Drives, Subfolders and Files, and under subFolders there is another subFolder and File collection nested inside it.

When I attempt to get a count of the subfolders at the top level, there is no problem;
lFolderIndex = FSfolder.subfolders.count and it returns the correct information (37 folders), however if I attempt to do lDirCount = FSfolder.SubFolders(lFolderIndex).Files.Count I get runtime error 5 Invalid procedure call or argument!

Even if I replace the lFolderIndex with a specific collection item number it gives me the same error. In the watch window I have expanded FSfolder and I see the nested collection subfolders and if I expand subfolders I see the Files collection and can look at each item. Why cant I access the elements programmatically? What am I doing wrong?

Any help would be appreciated...

Thanks
Gary