Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error Handler

Posted on 2003-12-04
4
Medium Priority
?
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Suggested Courses

610 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