Try this....
Code:Sub MoveFilesToAnotherFolder() Dim objFSO As Object 'FileSystemObject Dim objFile As Object 'File Dim objFolder As Object 'Folder Const strFolder As String = "C:\pull" Const strNewFolder As String = "C:\summary profits" Set objFSO = CreateObject("Scripting.FileSystemObject") For Each objFolder In objFSO.GetFolder(strFolder & "\").SubFolders If Right(objFolder.Name, 2) = "tb" Then For Each objFile In objFolder.Files If InStr(1, objFile.Type, "Excel", vbTextCompare) Then Name objFile.Path As strNewFolder & "\" & objFile.Name End If Next objFile End If Next objFolder End Sub




Reply With Quote
Bookmarks