How to deal with an error question

  • Thread starter Thread starter Ian Pellew
  • Start date Start date
I

Ian Pellew

Hi all;

How do I catch an error on
ChDir "C:\Documents and Settings\me\Desktop"
Workbooks.Open Filename:="Some_file.xls"
?
If the some_file.xls is cancelled ( because it is password protected )
I get a "run time error" from the debugger.

So how can I deal with this in a proper manner?

Regards
Ian
 
Try something Like this...

Public Sub Whatever()
On Error Goto ErrorHandler

'insert your code here...
exit sub

ErrorHandler:
msgbox "Oh Darn"
resume next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top