Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I assume you've figured out the problem by now, but for the sake of anyone else reading...
Don't include the equal sign (=) between the Unprotect method and the password argument. Use it like this: WkSht.Unprotect Pword Also, you'll often want to remember the Protected state just before you Unprotect. You can use a series of Boolean variables to do that. Here's an example. Dim blnDrawingObjects As Boolean Dim blnContents As Boolean Dim blnScenarios As Boolean Dim blnAutoFilter As Boolean Dim blnOutlining As Boolean Dim blnPivotTable As Boolean Dim blnUserInterface As Boolean With ThisWorkbook.Worksheets("MyWorksheetName") ' ' remember the protection state of the sheet ' blnDrawingObjects = .ProtectDrawingObjects blnContents = .ProtectContents blnScenarios = .ProtectScenarios blnAutoFilter = .EnableAutoFilter blnOutlining = .EnableOutlining blnPivotTable = .EnablePivotTable blnUserInterface = .ProtectionMode .Unprotect "MyPassword" ' do some stuff here that requires unprotected sheet |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protecting/Unprotecting all sheets with macro leads to "image" iss | Excel Worksheet Functions | |||
protecting and unprotecting | Excel Worksheet Functions | |||
Macro for protecting and unprotecting multiple worksheets | Excel Discussion (Misc queries) | |||
PROTECTING/UNPROTECTING SHEETS | Excel Discussion (Misc queries) | |||
Beta - unprotecting multiple sheets | Excel Programming |