Solved

Error Handler

Posted on 2003-12-04
4
287 Views
Last Modified: 2012-05-04
Hello All,

Any ideas to why my application won't read my error handler routine? In other words, I place some bad code, but Visual Basic error code appears and I can't get it to default to my error handler. Has something changed in the VB IDE? HELP. ADawn

On Error Goto ErrorHandler

     'Somewhere in here place bad code...

Exit_ErrorHandler:
Exit Sub
 
ErrorHandler:
 
  MsgBox "I_Should_See_This_Message"   'If working, I should see this message
 
  Call PublicMessengerErrors        
  Call ErrorLogger("cmdButtons_Click")
  Resume Exit_ErrorHandler
 
End Sub
0
Comment
Question by:ADawn
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 9873936
Right-click anywhere in the code editor where it is blank, select Toggle, then Break in class module.
0
 

Author Comment

by:ADawn
ID: 9873965
I think I found the problem. In the VB IDE there is a selection in Options: "Break On All Errors." I deselected this option (I selected: Break On Class Module) and now my code is read.

Question: Which option should be selected when I finally compile and distribute my application?

Thanks to All, ADawn.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9873995
>>Which option should be selected when I finally compile and distribute my application

I doesn't matter, this only affect VB IDE not the compile version
0
 
LVL 4

Expert Comment

by:PBuck
ID: 9875111
One more note which you may already be aware of?  But if you are calling other procedures without error handling then VB errors will appear.

So ...

Private Sub TestMe()
   On Error Goto err_Handler
   Call AnotherTest
   Exit sub

err_Handler:
   MsgBox "I see it!"
End Sub

Private Sub AnotherTest()
   Err.Raise 13
End Sub

Hope this helps
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question