ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Protection and XLA code (https://www.excelbanter.com/excel-programming/343488-sheet-protection-xla-code.html)

Datasort

Sheet Protection and XLA code
 
I am trying to unprotect a spreadsheet from some code in a workbook. Below
is the code:


ActiveWorkbook.Sheets("TRANSACTIONS")
. Unprotect strPassWord
€˜*** do stuff to worksheet
End with

This code is in a xla workbook.

If the code is called from the activeworkbook in a non save mode then it
works.

If the code is called from the Workbook.BeforeSave event then the code stops
with a protection error.
At this point, even in a debug mode, the sheet protection will not turn off.

Is there a known issue that prevents the activeworkbook sheet protection to
not be change during the before save event?

Any thoughts or work around?

Thanks in advance

--
Stewart Rogers
DataSort Software, L.C.


All times are GMT +1. The time now is 08:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com