concreteinterface
Board Regular
- Joined
- Jul 10, 2008
- Messages
- 144
I thought I was doing this right, but apparently not. Getting a "File Not Found" error when the file is not present in the folder. I know that the file sometimes won't be in the first folder or both folders. I think my On Error line isn't correct. What am I missing here?
Code:
Sub Copy()
SerialDate = Format(Date, "yymmdd") & Format(Time, "hhmmss")
CopyFileLocation = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & SerialDate & "\"
MkDir CopyFileLocation
For i = 2 To 1000
On Error Resume Next
FileCopy "V:\fullfilepath1\" & Range("B" & i).Value & ".pdf", CopyFileLocation & Range("B" & i).Value & ".pdf"
On Error GoTo ErrHandler
FileCopy "V:\fullfilepath2\" & Range("B" & i).Value & ".pdf", CopyFileLocation & Range("B" & i).Value & ".pdf"
GoTo SkipErr
ErrHandler:
Range("A" & i).Value = "COULD NOT EXTRACT!"
GoTo SkipErr2
SkipErr:
Range("A" & i).Value = SerialDate
SkipErr2:
Next
End Sub
Last edited: