Good afternoon Experts
I need a little help please.
I am using VBA to Copy a file from one location to another. All works fine, except...
On occasions the file may already exist in the new location, so I need to put a "1" on the end of the file (and if necessary increment)
The code I have is as follows:
Code
Dim MyPath As String
Dim DestPath As String
Dim MyFile As String
Dim MyExt As String
Dim wb As Workbook
Dim NewFile As String
MyPath = "C:\Users\Owner\Dropbox\Accounts Miqlat\"
DestPath = "C:\Users\Owner\Dropbox\Accounts Miqlat\Imported\" 'Destination to move completed file too
MyExt = "*.xlsx"
MyFile = Dir(MyPath & MyExt)
FileCopy MyPath & MyFile, DestPath & MyFile 'copy file to new location
Display More
I look forward to your responses.