ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect Workbook (https://www.excelbanter.com/excel-programming/290489-protect-workbook.html)

StanJ

Protect Workbook
 
I have some AutoOpen() routines including workbook protection

Sub AutoOpen(
ActiveWorkbook.Protect ("password"
End Su

When the workbook is protected from the previous close, this macro
actually turns protection off. If it was unprotected from the previous
close, then it turns back on. I can write a closing routine to counter
this, but it seems wierd to have to do this

Does anyone have ideas about this or am I doind something wrong


Ken Macksey

Protect Workbook
 
Hi

I have noticed this wierd behavior where protect acts
as a toggle in Excel 2002 as well. Why I don't know.

The only workaround I have found is to unprotect first,
then protect. This always seems to work correctly then.

ActiveWorkbook.Unprotect ("password")
ActiveWorkbook.Protect ("password")

HTH

KenM




All times are GMT +1. The time now is 11:16 AM.

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