Hello All,
I have pasted my comments below inside the code. I do not want to copy all files rather the "date modified" I select.
I have pasted my comments below inside the code. I do not want to copy all files rather the "date modified" I select.
Code:
Sub sbCopyingAllExcelFiles()
Dim FSO
Dim sFolder As String
Dim dFolder As String
Dim oFolder As String
sFolder = "C:\Users\tmhzka\Desktop\New folder"
dFolder = "C:\Users\tmhzka\Desktop\morning"older path
oFolder = "C:\Users\tmhzka\Desktop\morning\del"
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FolderExists(dFolder) Then
MsgBox "Source Folder Not Found", vbInformation, "Source Not Found!"
ElseIf Not FSO.FolderExists(oFolder) Then
MsgBox "Destination Folder Not Found", vbInformation, "Destination Not Found!"
Else
FSO.movefile (dFolder & "\*.*"), oFolder
MsgBox "Successfully Copied All Excel Files to Destination", vbInformation, "Done!"
End If
If Not FSO.FolderExists(sFolder) Then
MsgBox "Source Folder Not Found", vbInformation, "Source Not Found!"
ElseIf Not FSO.FolderExists(dFolder) Then
MsgBox "Destination Folder Not Found", vbInformation, "Destination Not Found!"
Else
'i want to be able to select a date modified instead of copying everything over to the folder.
FSO.CopyFile (sFolder & "\*.*"), dFolder
MsgBox "Successfully Copied All Excel Files to Destination", vbInformation, "Done!"
End If
End Sub