Excel VBA Code To Copy File
Excel VBA Code To Copy File
Sub Copy_files()
'www.comexcelhub.com
'This Code will copy the file form one folder to another Folder
'Source Folder name, Destination Folder Name and Source File Names should b
e
entered in the Excel WOrkbook Sheet1
'This is Your File Name which you want to Copy stored in the variable
sour_File = Range("C" & F_cntr)
'This is Your Source file FOlder path from Where you want to Copy the File
Src_Folder = Range("D" & F_cntr)
'This is Your Destination file FOlder path from Where you want
to Paste the File
Destin_Folder = Range("E" & F_cntr)
'Create Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Else
'Below Message is shown if already destination folder contains same File.
MsgBox "Specified File Already Exists In The Destination Folder", vbExc
lamation, "File Already Exists"
End If
Next F_cntr
End Sub