View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Error Handling question

Try changing that to "break on unhandled errors"

In general, it is better to use "Break In Class Module" rather than "Break
On Unhandled Errors". With break in class module, you'll enter debug mode on
the exact line within a class that caused the problem. With break on
unhandled errors, you'll break on the code that called the method of the
class, which is of little use for debugging. Of course, this is irrelevant
if you don't have code in any classes.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Dave Peterson" wrote in message
...
Inside the VBE, try:

Tools|Options|General Tab|Error Trapping Section
What's checked?
I'm guessing "break on all errors"

Try changing that to "break on unhandled errors"

If I did this in a General module:

Option Explicit
Sub testme()

On Error GoTo ErrorHand:
Err.Raise 33
On Error GoTo 0

Exit Sub

ErrorHand:
MsgBox Err.Number
Resume Next
End Sub

I'd get the debug window only if "break on all errors" was checked.


J@Y wrote:

I have this set of code:

On error goto ErrorHand:
code 1...
code 1...
code 1...
On error goto 0

ErrorHand:
code...

Somewhere within the Code 1, there is a type mismatch error, but the
program
doesn't go to ErrorHand, instead it goes debug window. Am I doing
something
wrong?


--

Dave Peterson