Copying Folders From One Location to Another in Excel VBA
'In this Example I am Coping "C:\Temp\" to "D:\Job\"
Sub sbCopyingAFolder()
Dim FSO
Dim sFolder As String, dFolder As String
sFolder = "C:\Temp\" 'Specify Your Source Folder
dFolder = "D:\Job\" ' Specify Your Destination Folder
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FolderExists(dFolder) Then
FSO.CopyFolder sFolder, dFolder
MsgBox "Folder Copied Successfully to The Destination", vbExclamation, "Done!"
Else
MsgBox "Folder Already Exists in the Destination", vbExclamation, "Folder Already Exists!"
End If
End Sub
No comments:
Post a Comment