Originally Posted by
June7
How many folder levels do you need to loop through? Just one?
I use FileSystemObject collection to declare and set folder objects to manipulate files.
This is part of a long procedure that saves reports as PDF then combines them with existing PDF documents.
Dim fso As Object, SourceFolder As Object, SFolder As Object, SSFolder As Object, SSSFolder As Object, PDFile As Object
Set objCAcroPDDocDestination = CreateObject("AcroExch.PDDoc")
Set objCAcroPDDocSource = CreateObject("AcroExch.PDDoc")
Set SourceFolder = fso.GetFolder("R:\Projects\LabReportsTemp")For Each SFolder In SourceFolder.subfolders
strPath = SourceFolder.Path & "" & SFolder.Name
If Dir(strPath, vbDirectory) = "" Then MkDir strPath
For Each SSFolder In SFolder.subfolders
...
For Each PDFile In SSSFolder.Files
...