Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel VBA - Error Handler Class

Posted on 2014-01-08
3
Medium Priority
?
598 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 1000 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

722 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