Forum

Excel VBA worksheet...
 
Notifications
Clear all

Excel VBA worksheet protection

3 Posts
2 Users
0 Reactions
154 Views
(@keebellah)
Posts: 373
Reputable Member
Topic starter
 

Hi, I wonder if anyone has questioned this.

In one of the files I helped a friend with the worksheets are protected using the UserInterfcaeOnly parameter so that working with it is not too difficult and you can easily avoid users accidentally delete cells with formulas or other things.

He does allow the users to unlock unprotect the worksheet using a button that serves as a toggle to unprotect/protect the worksheet.

The problem is that if a user protects the worksheet manually via de ribbon option or right-click on the tab the VBA routine will not work if it's a different password, so whole toggle button and the userinterfaceonly becomes useless.

Is there a way to disable the protect worksheet and workbook options for this particular file, some on workbook_open trigger to run a macro that takes care of this?

Versions of Excel are 2021 and 365 but mainly 2021

Thanks,

Hans

 
Posted : 06/09/2024 5:00 pm
(@debaser)
Posts: 837
Member Moderator
 

You can use Ribbon XML to disable or intercept those commands. Ron de Bruin's old Ribbon pages are now hosted on Jan Karel Pieterse's website thankfully: https://jkp-ads.com/rdb/

 
Posted : 07/09/2024 3:27 am
(@keebellah)
Posts: 373
Reputable Member
Topic starter
 

Thank you Veouria,

I'll take a look there didn't think of it.

I used RdB's tips often bue didn't realize JPK stated hosting them for him

 
Posted : 08/09/2024 5:57 pm
Share: