Hi,
I am currently using this programming to pull files into a workbook:
Option Explicit
Sub GetSheets()
Dim fPATH As String, fNAME As String, SheetName As String
Call PrepBy("userID", "Name", "DTime") 'notes who ran the macro
fPATH = Range("Directory").Text 'path to files - taken from Welcome sheet
If FileFolderExists(fPATH) = False Then
MsgBox "Folder does not exist, macro will exit"
Exit Sub
End If
fNAME = Dir(fPATH & "*.txt") 'get first filename from path
Do While Len(fNAME) > 0 'loop until no more filenames are found
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
SheetName = Left(fNAME, Len(fNAME) - 4)
ActiveSheet.Name = SheetName
If Left(fNAME, 5) = "HOGAN" Then
Call ImportHogan(fPATH, fNAME) 'import rules for hogan files
Else
Call ImportIBS(fPATH, fNAME) 'import rules for IBS
End If
'Debug.Print fNAME
fNAME = Dir 'get next filename
Loop
Sheets("Welcome").Select
MsgBox "The files have been loaded"
End Sub
The directory that the macro is pulling from contains hundreds of files so the users are currently copying the files they want into a separate folder and then running the macro. Is there a way to cut out that step and replace it with the option for them to pull a range of files based on the "Date Modified"? Any help is appreciated! Thank you!
Bookmarks