I am simply looking to do 3 things:
Hi guys these are my aims:
1.Copy text files in Source Folder " (shared drive).
2.Delete any files in destination Location (desktop drive C)
3.paste the copied folder in destination location.
I am starting with just doing 1 & 3 to begin with:
Sub foldermove()
Dim fs As Variant
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfolder "Y:\Brand Team\Clients\John\John Handset Reporting\Raw Input\Log Files\2013 Week 17", "C:\Users\Max\Desktop"
end Sub
I have errors with this approach.
This was another attempt, which moves file by file within the folders (the first technique above is my preferred option however).
This keeps returning Err 53
any ideas on how to proceed?
Private Sub bCopyDirectoryFiles_Click()
On Error GoTo Err_bCopyDirectoryFiles_Click
Dim fso As Scripting.FileSystemObject
Dim sSourceDir As String, sDestinationDir As String
Set fso = New Scripting.FileSystemObject
sSourceDir = "Y:\Brand Team\Clients\John\John Handset Reporting\Raw Input\Log Files\2013 Week 17*.*"
sDestinationDir = "C:\Users\Max\Desktop" 'No ending back slash for the final directory!
fso.CopyFile sSourceDir, sDestinationDir, True
MsgBox "Files copied"
Exit_bCopyDirectoryFiles_Click:
Exit Sub
Err_bCopyDirectoryFiles_Click:
If Err = 53 Then 'File not found
Beep
MsgBox "No files found in the source directory.", vbInformation
Exit Sub
ElseIf Err = 76 Then 'Path not found
Beep
MsgBox "The destination directory does not already exist.", vbInformation
Exit Sub
Else
MsgBox Err.Number & " - " & Err.Description
Resume Exit_bCopyDirectoryFiles_Click
End If
End Sub
Bookmarks