I have a simple app that copies files from one location to another. The file names to be copied are listed in an array (myList) and error trapping is in place that generates a message box EACH time a file is not found.
Question, instead of a message box for every file not found, is it possible to store the missing files somehow and generate just one message box at the end that displays all of the missing files?
The code that produces multiple message boxes:
For I = LBound(myList) To UBound(myList)
On Error GoTo Err_cmdCopyFiles_Click
FileCopy strCopyFrom & myList(I), strDestinationFile & myList(I)
Next I
Err_cmdCopyFiles_Click:
Select Case Err.Number
Case 53
MsgBox myList(I) & " was not found in:" & vbCrLf & _
strCopyFrom, vbInformation, "File Copy Error"
Resume Next
Case 76
MsgBox "Destination file path " & strDestinationFile & _
" not found.", vbInformation, "File Copy Error"
Exit_cmdCopyFiles_Click:
Exit Sub
End Select
Thank you in advance for your help!
Question, instead of a message box for every file not found, is it possible to store the missing files somehow and generate just one message box at the end that displays all of the missing files?
The code that produces multiple message boxes:
For I = LBound(myList) To UBound(myList)
On Error GoTo Err_cmdCopyFiles_Click
FileCopy strCopyFrom & myList(I), strDestinationFile & myList(I)
Next I
Err_cmdCopyFiles_Click:
Select Case Err.Number
Case 53
MsgBox myList(I) & " was not found in:" & vbCrLf & _
strCopyFrom, vbInformation, "File Copy Error"
Resume Next
Case 76
MsgBox "Destination file path " & strDestinationFile & _
" not found.", vbInformation, "File Copy Error"
Exit_cmdCopyFiles_Click:
Exit Sub
End Select
Thank you in advance for your help!