In this post:

An inviting error message with features! This will make a difference for the development of a VBA-Project. Error services inspired by the-best-of-the-web, worth being considered not only by professionals.

Preface

The Common VBA Error Services introduced by this post might appear overdone, too complicated, not worth the effort, etc.. It became my standard throughout all VB-Projects however. On the long run it proved worth the effort, foremost because it helps locating and eliminating an error a snap. The README in the corresponding public GiHub repo provides all the details for installation and usage. For experienced developers it will take not more than 30 minutes to finish the task. A true investment for future VBA development.

Disambiguation

| Term | Meaning | | ————— | ———————————————– | |Application Error| An error which had been raised by an err.Raise statement distinguished from any system error like VB-Run-time or Database error. In order to avoid conflicts with system error numbers the vbObjectError is added to turn it into a negative number. The error service uses an AppErr function for this which turns the negative back into its original positive number for the display of the error. | |Entry Procedure| For the error display this is one of the key issues for the assembling of the path-to-the-error.| |Error Source | An unambiguous name of the procedure which raised an error - by prefixing the procedure name with the module name.| |_Common Components, Component| Term used for all my Common VBA Components of which the code is kept identical with all VB-Projects using them. A tough matter but successfully implemented and used. See: |

Features

Summary

The advantage of the error display service may best be depicted by the following:

  1. The display of an error message by means of the VBA.MsgBox - already enriched with the debugging option This is my standard without using any extra modules. Pure VBA in fact.

  2. The display of an error message by means of the mMsg.ErrMsg service: Looks much better and the debugging option is much more self explanatory.

  3. The display of an error message by means of the mErH.ErrMsg service: For complex VBA-Projects and/or those having a (recommended by professionals) fine module structure, having the “path-to-the-error” displayed can make a difference.

Conclusion

A error message displayed by the mErH.ErrMsg service provides:

Comments

Any comments are welcome whether here in this blog or in the public GiHub repo which is open for Discussions. I apologize for the fact that whichever way is used requires an account and a login. This is the only way to hinder spammers.