Hello my Masters
I Want your Helping in Modify this Code ,to Collect and merge all Excel Files from Certain Partition to Certain Folder , but I don't Know The Reason in This code does not work as well
Because I Want All Excel Files brought in this Folder Name "Test100"
thanks alot
I Want your Helping in Modify this Code ,to Collect and merge all Excel Files from Certain Partition to Certain Folder , but I don't Know The Reason in This code does not work as well
Because I Want All Excel Files brought in this Folder Name "Test100"
thanks alot
Code:
Sub copy_specific_files_in_folder()
Dim FSO As Object
Dim sourcePath As String
Dim destinationPath As String
Dim fileExtn As String
sourcePath = "D:\EXC.Dep"
destinationPath = "C:\Users\Hany.Ali\Downloads\Test100\"
fileExtn = " * .xl * "
If Right(sourcePath, 1) <> " \ " Then
sourcePath = sourcePath & " \ "
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(sourcePath) = False Then
MsgBox destinationPath & " does not exist"
Exit Sub
End If
If FSO.FolderExists(destinationPath) = False Then
MsgBox sourcePath & " does not exist"
Exit Sub
End If
FSO.CopyFile Source:=sourcePath & fileExtn, Destination:=destinationPath
MsgBox "Your files have been copied from " & sourcePath & " to " & destinationPath
End Sub