Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unprotecting sheet did not prompt for password
I have automated sheets to be protected by a global variable g_mStrPW.
However, when trying to unprotect individual sheet, the sheet gets unprotected without prompting for password. This is bad and made protecting sheets meaningless. Here is the code used to protect all sheets. Private Sub LockEM_Click() Dim i As Long Dim WS As Worksheet g_mStrPW = InputBox("Password:") On Error GoTo MyErr For Each WS In ActiveWorkbook.Worksheets WS.Protect (g_mStrPW) If WS.Protection.AllowUsingPivotTables = False Then WS.Protect AllowUsingPivotTables:=True WS.Protect AllowFiltering:=True End If Next MsgBox i & " errors found", vbInformation Exit Sub MyErr: i = i + 1 Resume Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro asking for a password twice when unprotecting sheet | Excel Programming | |||
Password Protecting/Unprotecting Via Code | Excel Programming | |||
Unprotecting password protected workbook | Excel Discussion (Misc queries) | |||
password prompt to unhide sheet | Excel Programming | |||
Simple password function - unprotecting sheets | Excel Programming |