Hi all,
The following code prints folder names a collection of 'folders'...
Dim fso As New FileSystemObject
Dim fld As Folder
Dim tFld As Folder
Set fld = fso.GetFolder("c:\"
If fld.SubFolders.Count > 0 Then
For Each tFld In fld.SubFolders
Debug.Print tFld.path
Next
End If
How do I retreive a specific folder from the collection using a subscript as suggested by the documentation on collections??? nothing seems to work...
fld.SubFolders(1)
fld.SubFolders.item(1)
fld.SubFolders(1).path
etc...
Thanks much,
bill
Dim objFolder As Scripting.Folder
Dim objFile As Scripting.File
Dim objSubdirs As Scripting.Folders
Dim objLoopFolder As Scripting.Folder
Set objFolder = fso.GetFolder(pRs("path")
For Each objFile In objFolder.Files
Debug.Print objFile.ShortPath
Next objFile
The following code prints folder names a collection of 'folders'...
Dim fso As New FileSystemObject
Dim fld As Folder
Dim tFld As Folder
Set fld = fso.GetFolder("c:\"
If fld.SubFolders.Count > 0 Then
For Each tFld In fld.SubFolders
Debug.Print tFld.path
Next
End If
How do I retreive a specific folder from the collection using a subscript as suggested by the documentation on collections??? nothing seems to work...
fld.SubFolders(1)
fld.SubFolders.item(1)
fld.SubFolders(1).path
etc...
Thanks much,
bill
Dim objFolder As Scripting.Folder
Dim objFile As Scripting.File
Dim objSubdirs As Scripting.Folders
Dim objLoopFolder As Scripting.Folder
Set objFolder = fso.GetFolder(pRs("path")
For Each objFile In objFolder.Files
Debug.Print objFile.ShortPath
Next objFile