ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macros, Protected Books & Missing Passwords (https://www.excelbanter.com/excel-worksheet-functions/21962-macros-protected-books-missing-passwords.html)

jamesanddavid

Macros, Protected Books & Missing Passwords
 
Hi,

I am running a Macro from one workbook that open another workbook which has it's cells protected. As part of the Macro I enter the password to unprotect the workbook, perform various functions, then reprotect the workbook with the same password.

When I run the Macro it does all that I intended.

If I now open the 2nd workbook, the book is still protected. When I go to choose unprotect, it does without any password!

So even though in the Macro I renter the password, it seems the Macro is protecting the book but without any password!

I've double checked the code and redid the Macro several times all with the same result.

Help!

Nige

Hi jamesanddavid - hmm... are you protecting and unprotecting the worksheet
(so individual cells can be locked, etc) and protecting/unprotecting the
workbook?

Probably obvious, but when you re-protect in code, are you specifying the
password for both worksheet and workbook then, and not only when
unprotecting? And again obviously.. you're saving the workbook AFTER you've
set the protection password(s)?

Nige


"jamesanddavid" wrote:


Hi,

I am running a Macro from one workbook that open another workbook which
has it's cells protected. As part of the Macro I enter the password to
unprotect the workbook, perform various functions, then reprotect the
workbook with the same password.

When I run the Macro it does all that I intended.

If I now open the 2nd workbook, the book is still protected. When I go
to choose unprotect, it does without any password!

So even though in the Macro I renter the password, it seems the Macro
is protecting the book but without any password!

I've double checked the code and redid the Macro several times all with
the same result.

Help!


--
jamesanddavid



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

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