R
Raj
Hi,
I have the following code in Thisworkbook module:
Private Sub Workbook_Open()
UnprotectWorkbook
UnHideSheets
ProtectWorkbook
End Sub
Private Sub ProtectWorkbook()
ThisWorkbook.Protect Structure:=True, Windows:=False, password:="xxxx"
'MsgBox ("Protected")
End Sub
Private Sub UnprotectWorkbook()
ThisWorkbook.Unprotect password:="xxxx"
End Sub
The Unhidesheets macros is from http://www.cpearson.com/excel/EnableMacros.aspx
But despite the ProtectWorkbook line in the Workbook open event, the
Workbook is unprotected on opening. Am I doing something wrong. I
tried putting a message box in the Protecteworkbook (commented out
above). The message box pops up, indicating that processing has
reached that stage. But the workbook still remains unprotected on
opening.
Am I doing something wrong? Please help.
Thanks in advance.
Regards,
Raj
I have the following code in Thisworkbook module:
Private Sub Workbook_Open()
UnprotectWorkbook
UnHideSheets
ProtectWorkbook
End Sub
Private Sub ProtectWorkbook()
ThisWorkbook.Protect Structure:=True, Windows:=False, password:="xxxx"
'MsgBox ("Protected")
End Sub
Private Sub UnprotectWorkbook()
ThisWorkbook.Unprotect password:="xxxx"
End Sub
The Unhidesheets macros is from http://www.cpearson.com/excel/EnableMacros.aspx
But despite the ProtectWorkbook line in the Workbook open event, the
Workbook is unprotected on opening. Am I doing something wrong. I
tried putting a message box in the Protecteworkbook (commented out
above). The message box pops up, indicating that processing has
reached that stage. But the workbook still remains unprotected on
opening.
Am I doing something wrong? Please help.
Thanks in advance.
Regards,
Raj