Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Limiting the scope of On Error

I would like to apply On Error error checking within a specific procedure
only.

If I do, something like....

Sub Test()

On Error Goto ErrorHandler
- code -
- code -

ErrorHandler:
msgbox "dddd"
End Sub

Will On Error still be active after this procedure finishes? If so, is
there a way to switch off On Error? I want to handle the error in this
routine, but I want the application to stop and show the error everywhere
else.

Regards,

Android.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Limiting the scope of On Error

On Error will still be active if you call another procedure, but when the
code terminates, it dies. Any further code run afterwards will return to the
default error handling.

You can return error handling to the default with

On Error Goto 0

If you want to ignore errors (sic!), or trap them individually, use

On Error Resume Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Android" wrote in message
...
I would like to apply On Error error checking within a specific procedure
only.

If I do, something like....

Sub Test()

On Error Goto ErrorHandler
- code -
- code -

ErrorHandler:
msgbox "dddd"
End Sub

Will On Error still be active after this procedure finishes? If so, is
there a way to switch off On Error? I want to handle the error in this
routine, but I want the application to stop and show the error everywhere
else.

Regards,

Android.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Limiting the scope of On Error

Thank you.

Android.

"Bob Phillips" wrote in message
...
On Error will still be active if you call another procedure, but when the
code terminates, it dies. Any further code run afterwards will return to

the
default error handling.

You can return error handling to the default with

On Error Goto 0

If you want to ignore errors (sic!), or trap them individually, use

On Error Resume Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Android" wrote in message
...
I would like to apply On Error error checking within a specific

procedure
only.

If I do, something like....

Sub Test()

On Error Goto ErrorHandler
- code -
- code -

ErrorHandler:
msgbox "dddd"
End Sub

Will On Error still be active after this procedure finishes? If so, is
there a way to switch off On Error? I want to handle the error in this
routine, but I want the application to stop and show the error

everywhere
else.

Regards,

Android.






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
Name scope within a workbook Christer Excel Discussion (Misc queries) 0 March 24th 10 10:32 PM
Name Scope Slim Slender[_2_] Excel Worksheet Functions 2 December 16th 09 01:38 AM
Scope of name Slim Slender Excel Discussion (Misc queries) 0 December 13th 09 10:01 PM
Range Name Scope Gee Excel Discussion (Misc queries) 4 September 22nd 09 01:32 PM
Change scope of a name hmm Excel Discussion (Misc queries) 0 October 30th 08 02:36 PM


All times are GMT +1. The time now is 06:49 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"