U
u473
How do I adapt the following code from Bob Philips (to traverse all of
the folders and subfolders)
to print All Workbooks
Thank you for your help,
Wayne
' ***********************************************************
Sub CallingProc()
Dim strPath As String
Dim fso As Object
Dim oDir As Object
strPath = "P:\Accounts Receivable\Cost Centers"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oDir = fso.getfolder(strPath)
PrintFolderName oDir
Set fso = Nothing
Set oDir = Nothing
End Sub
' ***********************************************************
Sub PrintFolderName(Dir As Object)
Dim fSubDir As Object
' Supposed to be recursive...
' Print the folder name.
Debug.Print Dir.Name
' Check subfolders recursively.
For Each fSubDir In Dir.SubFolders
PrintFolderName fSubDir
Next fSubDir
End Sub
the folders and subfolders)
to print All Workbooks
Thank you for your help,
Wayne
' ***********************************************************
Sub CallingProc()
Dim strPath As String
Dim fso As Object
Dim oDir As Object
strPath = "P:\Accounts Receivable\Cost Centers"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oDir = fso.getfolder(strPath)
PrintFolderName oDir
Set fso = Nothing
Set oDir = Nothing
End Sub
' ***********************************************************
Sub PrintFolderName(Dir As Object)
Dim fSubDir As Object
' Supposed to be recursive...
' Print the folder name.
Debug.Print Dir.Name
' Check subfolders recursively.
For Each fSubDir In Dir.SubFolders
PrintFolderName fSubDir
Next fSubDir
End Sub