Hi
I have the following macro to move files from one folder to another,however I get an error if the file already exists. I have read many other snippets of code to resolve this, however I am still having problems
Here is the code I currently have
Sub Move_Files_In_Folder()
Application.Calculation = xlManual
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
FromPath = "F:\OLDFOLDER"
ToPath = "F:\NEWFOLDER"
FileExt = "*.xl*"
'Use *.* for all files
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
If FSO.FolderExists(ToPath) = False Then
MsgBox ToPath & " doesn't exist"
Exit Sub
End If
FSO.MoveFile Source:=FromPath & FileExt, Destination:=ToPath
MsgBox "You can find the files from " & FromPath & " in " & ToPath
Application.Calculation = xlAutomatic
End Sub
Any help would be great
Thanks
Bookmarks