vba copy folders to a different location code example
Example: vba code to file download from another folder
Sub sbCopyingAFile()
Dim FSO
Dim sFile As String
Dim sSFolder As String
Dim sDFolder As String
sFile = "Sample.xls"
sSFolder = "C:\Temp\"
sDFolder = "D:\Job\"
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(sSFolder & sFile) Then
MsgBox "Specified File Not Found", vbInformation, "Not Found"
ElseIf Not FSO.FileExists(sDFolder & sFile) Then
FSO.CopyFile (sSFolder & sFile), sDFolder, True
MsgBox "Specified File Copied Successfully", vbInformation, "Done!"
Else
MsgBox "Specified File Already Exists In The Destination Folder", vbExclamation, "File Already Exists"
End If
End Sub