Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro error opening text file Jim C Excel Discussion (Misc queries) 0 November 6th 09 04:05 PM
Unnecessary error message on opening file with links Dan H Links and Linking in Excel 0 December 12th 08 10:58 AM
Error message opening Excel file Mark Excel Discussion (Misc queries) 0 February 6th 08 04:43 PM
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. Tim Marsden Charts and Charting in Excel 2 October 15th 05 02:10 PM
macro error when opening any file psp Excel Discussion (Misc queries) 1 January 31st 05 04:33 PM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"