Shawn
asked on
do not delete if error
The code below copies a file and renames it in a new folder. Right now the old file is deleted right away but I only want to delete it if the copy suceeded.
How would I do this?
Private Sub btnAttributeAll_Click()
Dim SourceFile, DestinationFile
SourceFile = "G:\Scans\Scan - 262i\test.jpg" ' Define source file name.
DestinationFile = "G:\Scans\test moved\testmoved.jpg" ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to target.
Kill SourceFile
MsgBox "moved file " & SourceFile
End Sub
How would I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER