Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Trapping
Hi, I have a data table that has file path and name
information, I am running a loop across it which opens up each path&filename, reads in some data from the file into an array, then closes the file and dumps the contents of the array into my spreadsheet. This all works fine but I want to error trap if a user deletes on of the files, I can use the on error statement, but the fileopen statement is in the loop, and once I go out of the loop to the error code I dont know how to get back to the correct place in my original loop ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Trapping
why not avoid the error - don't try to open a missing file
sPath = "C:\My Documents" for each cell in Range("A1:A10") sStr = sPath & "\" & Cell.Value if dir(sStr) < "" then ' file exists, open it end if Next -- Regards, Tom Ogilvy "Neil" wrote in message ... Hi, I have a data table that has file path and name information, I am running a loop across it which opens up each path&filename, reads in some data from the file into an array, then closes the file and dumps the contents of the array into my spreadsheet. This all works fine but I want to error trap if a user deletes on of the files, I can use the on error statement, but the fileopen statement is in the loop, and once I go out of the loop to the error code I dont know how to get back to the correct place in my original loop ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Trapping | Excel Discussion (Misc queries) | |||
Trapping #VALUE! error | Excel Discussion (Misc queries) | |||
Error Trapping from WSH | Excel Discussion (Misc queries) | |||
error trapping | Excel Discussion (Misc queries) | |||
error trapping | Excel Programming |