Custom error message - VBA

Margiemarsupial

New Member
Joined
Jun 1, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi

So, I have a spreadsheet with two layers of VBA approval buttons built into the form. Meaning, round one of approvals protects the sheet using one password and round two protects it using a different password. This way, you can’t remove a signature after round one is complete.
As you’d hope in this case, an error occurs when you try to click a button associated with round 1. Since the passwords are different, the debug error pops up.
So my question is - can I change that to be a custom error message? Instead of “end/debug” standard, I want to to pop up and say something like “Signature can no longer be overwritten. Please contact your xxx rep for more details.”
 

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".
hi and welcome to MrExcel. if you are getting debug issues, there is a problem with your code. can you post the code
 
Upvote 0
Can you use an 'If' for when the button is clicked and control the outocme? If the passwords do not match, show messsage box if they match then run the code.

As above the code would be useful.
 
Upvote 0
The debug is occurring because the two passwords associated with the approval buttons do not match. That is exactly what I want because I want those other signatures to be locked in place after round one.
I was hoping I could customize the error message rather than it looking like my code isn’t work when it is.
 
Upvote 0
you dont write code that fails on errors. you are supposed to capture the error or stop it occurring. cant assist without seeing what you have written
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,572
Members
448,972
Latest member
Shantanu2024

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