VBA error - reporting the line of problem code???

liampog

Active Member
Joined
Aug 3, 2010
Messages
312
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I currently have a VBA project within a sheet that is password-protected so that my users cannot tamper with it.

If there is a problem with the code, it doesn't show the line of code in yellow for obvious reasons that the project is protected.

What I'd like to do is to create a macro that, when there is a problem with the code, it pings off an e-mail to me with the problem line of code in the body of the e-mail.

Is there a function or anything that reports the line of problem code?

I can test it with a MsgBox if necessary.

I don't need any code to send the e-mail as I have that already.

Liam
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
If you are trapping the error (e.g. On Error GoTo) then "Erl()" will give you the line number - but only if you have added line numbers to your code.
MZ Tools add-in will give you that capability.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top