Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to deal with an error question

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default How to deal with an error question

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

"Ian Pellew" wrote:

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

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
To deal with #NA Amin Excel Worksheet Functions 2 April 28th 10 07:06 AM
Has anyone made a Deal or No Deal Gamebord [email protected] Excel Discussion (Misc queries) 2 April 17th 08 12:12 AM
can Excel really deal with elapsed time? daudioguy Excel Discussion (Misc queries) 1 December 8th 07 11:06 PM
What's the deal here? thanks pgarcia Excel Discussion (Misc queries) 6 September 17th 07 07:08 PM
How to deal with a growing dataset... Joe Porkka [MSFT] Excel Discussion (Misc queries) 6 August 26th 07 05:12 AM


All times are GMT +1. The time now is 04:30 AM.

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"