I have the xlsm version allowing the user to access the Review Ribbon and the Protect Section to allow them to unprotect sheets. However when this is compiled via XLSPadlock to create the executable (exe) this Protect section is greyed out for both the Sheet and Workbook protection. How can I re-enable it within the exe please? There does not seem to be any mention of it in the manual.
Since XLS Padlock compiles the workbook into an independent executable, some native Excel functionalities might not be available or work the same way. This includes the ability to unprotect sheets or workbook from Excel’s built-in ribbon interface.
You can provide an alternative method to unprotect sheets or workbooks through a button or a custom ribbon that runs a VBA procedure to unprotect the workbook or sheets. Here is a basic example of a VBA procedure to unprotect a sheet:
Sub UnprotectSheet() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets("YourSheetName") 'replace "YourSheetName" with your actual sheet name 'Enter the password to unprotect the sheet ws.Unprotect Password:="YourPassword" 'replace "YourPassword" with your actual password End Sub
This will unprotect the sheet named “YourSheetName” when the procedure is executed. You can tie this procedure to a button or custom UI element that your users can interact with.
Remember to replace
"YourPassword" with your actual sheet name and password. You may also want to handle potential errors, such as the user trying to unprotect a sheet that is already unprotected.
Hope this helps.
Thank you for the reply.
I use the WorkBook and Worksheet protect and unprotect methods in the VBA but in the xlsm mode the User (me) could select the Unprotect Sheet from the ribbon. In the exe environment the behaviour has usually always been the same except for this once instance. That prompted me to wonder what was different – whether it was a setting within the XLSpadlock build or the state of play within the xlsm at time of compile – with no obvious solution found.
If one good thing has come out of it I was prompted to build into the custom ribbon not the unprotect sheet option but the delete row that required the unprotection – with of course the added rules of engagement!
A sort of half-win win situation.