Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
stop error message when opening a non existant file in a macro
In a macro jn Excel 2007, I am opening files from a list, when the file
doesn't exist I get an error message. How can I stop this and go on to the next one? I can stop the first with an onerror statement but if it finds a second non-existant file it ignores this and gives an error message. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
stop error message when opening a non existant file in a macro
Generally speaking post your code... Without code then something like this
might work... dim wbk as workbook 'start loop here on error resume next set wbk = workbooks.open "Whatever" on error goto 0 if wbk is nothing then msgbox "No such file" else msgbox "Process the file" end if 'end loop here -- HTH... Jim Thomlinson "swar phil" wrote: In a macro jn Excel 2007, I am opening files from a list, when the file doesn't exist I get an error message. How can I stop this and go on to the next one? I can stop the first with an onerror statement but if it finds a second non-existant file it ignores this and gives an error message. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro error opening text file | Excel Discussion (Misc queries) | |||
Unnecessary error message on opening file with links | Links and Linking in Excel | |||
Error message opening Excel file | Excel Discussion (Misc queries) | |||
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. | Charts and Charting in Excel | |||
macro error when opening any file | Excel Discussion (Misc queries) |