ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   password protecting sheet when workbook opens (https://www.excelbanter.com/excel-programming/353126-password-protecting-sheet-when-workbook-opens.html)

mercer77

password protecting sheet when workbook opens
 

I want a sheet in my workbook to be automatically protected when i
opens. So, I put this into 'ThisWorkbook':

Private Sub Workbook_Open()
Password = "jack"
ThisWorkbook.Sheets("invoice list").Protect Password:=Password
End Sub

Then I closed the workbook, reopened it, and the sheet was protected
However, I am now unable to unprotect it, as I keep getting told tha
I've got the wrong password!

Firstly, does anyone know how I can unprotect this? Secondly, what di
I do wrong? how can I get this to work?

Thanks!

--
mercer7
-----------------------------------------------------------------------
mercer77's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=51164


mercer77[_2_]

password protecting sheet when workbook opens
 

ok, I managed to unprotect it using this rather impressive tool:
http://www.pcworld.com/downloads/fil...d,22990,00.asp

But, I still don't understand why this happened. Any ideas

--
mercer7
-----------------------------------------------------------------------
mercer77's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=51164


mercer77[_3_]

password protecting sheet when workbook opens
 

Problem solved!

This seems to work, basically specifying the workbook. I don'
understand the difference - I guess it's just one of those littl
mysteries.... :)

Private Sub Workbook_Open()
Dim Password
Password = "jack"
Workbooks("INVOICESv2a.XLS").Sheets("invoice list").Protec
Password:=Password
End Su

--
mercer7
-----------------------------------------------------------------------
mercer77's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=51164



All times are GMT +1. The time now is 12:11 PM.

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