I Have the folowing code where I want to open up all files in a folder C:\pull as well as all the folders within C:\pull where the name contains ACCNTS(P). These are all XLS files
See code below, which does nothing when acticated
Code:Option Explicit Sub Open_Files_Pull() Dim fso As Object 'FileSystemObject Dim fldStart As Object 'Folder Dim fld As Object 'Folder Dim fl As Object 'File Dim Mask As String Set fso = CreateObject("scripting.FileSystemObject") ' late binding 'Set fso = New FileSystemObject 'or use early binding (also replace Object types) Set fldStart = fso.GetFolder("C:\Pull") ' <-- use your FileDialog code here Mask = "(p)*.xls" Debug.Print fldStart.Path & "\" ListFiles fldStart, Mask For Each fld In fldStart.SubFolders ListFiles fld, Mask ListFolders fld, Mask Next End Sub Sub ListFolders(fldStart As Object, Mask As String) Dim fld As Object 'Folder For Each fld In fldStart.SubFolders Debug.Print fld.Path & "\" ListFiles fld, Mask ListFolders fld, Mask Next End Sub Sub ListFiles(fld As Object, Mask As String) Dim fl As Object 'File For Each fl In fld.Files If fl.Name Like Mask Then Debug.Print fld.Path & "\" & fl.Name End If Next End Sub


Reply With Quote

Bookmarks