Automatically Input Error Handling VBA

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Automatically Input Error Handling VBA

Post by santosm »

Hi All,
Is there any way to automatically make it so that error handling code gets put in by default?

Code: Select all

On Error Goto ErrHandler

ErrHandler:
msgbox err.description
resume next


Thanks,
Mark
Thanks,
Mark

User avatar
HansV
Administrator
Posts: 78411
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Automatically Input Error Handling VBA

Post by HansV »

MZ-Tools 3.0 is a free add-in for the Visual Basic Editor in all versions of MS Office except for the 64-bit version of Office 2010/2013. One of its features is that you can create a "template" for your procedures, complete with error handling.
Best wishes,
Hans

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Re: Automatically Input Error Handling VBA

Post by santosm »

Cool, I will check that out!

Thanks,
Mark
Thanks,
Mark

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Automatically Input Error Handling VBA

Post by Wendell »

For what it's worth, I highly recommend it as well - if you are doing a complex development with lots of VBA, I consider it essential. And it handles adding and removing line numbers to code which can be very helpful in debugging errors.
Wendell
You can't see the view if you don't climb the mountain!

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Re: Automatically Input Error Handling VBA

Post by santosm »

Thanks Wendell!
Thanks,
Mark