Solved

Excel VBA - Error Handler Class

Posted on 2014-01-08
3
563 Views
Last Modified: 2014-02-25
Has anyone created an Error Handler Class in Excel VBA?

I've seen this
Previous discussion 2009

Thanks.
0
Comment
Question by:hindersaliva
[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
3 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 39767060
I'm not sure what you mean as each object needs to handle its own errors using the built in Err object
What are you ring to achieve that you can't with On Error Goto [label] etc
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39767269
This is the first thing I looked for when I started programming in VB in 1992.

Surprised to see that none existed, I had just found out a way to become a millionnaire.

I worked on the thing for a while, and saw quite fast why there was nothing like that anywhere.

There are so many ways that a given error could be handled that everytime I wanted to use my error library, I ended up having to add a Case or a If to handle the way I needed to handled the error in the current application.

Take the simple problem of trying to react to a "File not found".

- Do you ask the user to tell you where the file is located?
- Do you display an interface that lets the user navigate to the file?
- Do you create a new file with a default name?
- Do you create a new file after asking the user for a name?
- If you decide on the last one, do you also ask for a location?
- Can the application continue to work without that file, or do you have to close everything?

Every appliction will have its own way of reacting to that situation. It is finally easier to deal with the problem in the module or sheet that gets the error than using an external class that always end up not providing the feature that you need at that specific point in the code.

It might be possible to build one for a specific application. But not a general class that you can reuse everywhere.
0
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 250 total points
ID: 39767695
Hi,

Has anyone created an Error Handler Class in Excel VBA?

Dick Kusleika has just published an example via his Blog ("Daily Dose of Excel") based on ideas he developed from the "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA, and .NET" (2nd Edition) Paperback book written by Rob Bovey, Dennis Wallentin, Stephen Bullen, & John Green:

"Error Handling via an Error Class" (January 2, 2014, 12:34 pm)
[ http://dailydoseofexcel.com/archives/2014/01/02/error-handling-via-an-error-class/ ]

BFN,

fp.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

752 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