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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,337
Office Version
  1. 2010
Platform
  1. Windows
hi and welcome to MrExcel. if you are getting debug issues, there is a problem with your code. can you post the code
 

sxhall

Board Regular
Joined
Jan 5, 2005
Messages
150
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.
 

Margiemarsupial

New Member
Joined
Jun 1, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
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.
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,337
Office Version
  1. 2010
Platform
  1. Windows
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
 

Forum statistics

Threads
1,144,518
Messages
5,724,821
Members
422,580
Latest member
ScotIain76

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
Top