Excel VBA - Error Handler

This VBA Error Handler will stop the DEBUG message from popping up for users and will make you look like a pro! It will log all of the errors in a .txt file and provide instructions to the user on what to do in the case of an Error. Step up your VBA game now!

Get Your Copy Here:

Overview

1 Minute Overview

1 minute explanation of what this is, how it works, and how it could make an immediate impact for your team.

1 Hour Deep Dive

1 hour video breaking down every piece of the code to help you understand what it’s doing and how it can improve your VBA projects.

Why Should You Use This?

If you build and deliver VBA tools for anyone other than yourself, this error handler can be beneficial for several reasons:

  • It’s plug and play. If you download the workbook above, you can use that workbook as a template for building tools.
  • It stops the Debug window from popping up completely.
  • It allows all Subroutines to run even if one or more of them contain an error.
  • It automatically generates an Error Log dynamically so that previous Error Logs are not overwritten.
  • It logs which Subroutine is running, if there is an error, which one, and if it does not error it will log the amount of time it took to run.
  • And MORE
These are just some of the benefits of using this debugger. Most importantly your user/client won’t think something terrible has happened when an error occurs because the error handler provides instructions on what to do in the event of an error. This will make a better development experience for you and a better user experience for those you build tools for.

How Do You Use This?

Using this could not be any simpler, just follow the steps below:

  • Scroll to the top of this page and click on the button: ‘VBA Error Handler Workbook’
  • A .ZIP file should be downloaded into your computer’s Downloads folder.
  • Put the file where you want, right click, and select ‘Extract All’
  • You should now have access to 2 files. One to follow along with the video above and one to use as a template for all of your projects. 
  • For both files: right click on the file, select Properties, and look at the bottom of the General tab.
  • There will be a check box labeled ‘Unblock’, check that box and click Apply.
  • Open the workbook and select ‘Enable Content’ if you see a yellow message bar at the top of the workbook appear.
  • It is ready to use, enter VBA as normal and begin writing your code within the clearly marked spaces.

Workbook Updates

Version 1 Release: 4/18/2024

  • Version shown in video.

Version 2 Release: 5/1/2024

  • On Error Resume Next added to Error handler start.
  • Overwrite protection improved.
  • SavePath input moved in Error Handler start so it prompts the user regardless of DeveloperMode status.
  • Closing Message updated to include Save Path.