ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unprotect Sheet with Password Included (https://www.excelbanter.com/excel-programming/407824-unprotect-sheet-password-included.html)

James C.

Unprotect Sheet with Password Included
 
Hi,

Hoping someone can help. I am trying to create a button that does the
following

1. Unprotects my excel sheet
2. Automatically inserts the unprotect password into the string so the user
doesn't have to type it. Probably seems odd and a bad use of even having a
password but in the end it makes sense for what I am trying to do.

Right now I am using the following code to unprotect the sheet, but again it
prompts me for the password instead of automatically inserting it in.

Activesheet.unprotect

Thanks for any help



Nigel[_2_]

Unprotect Sheet with Password Included
 
You can add the password parameter to both unprotect and protect

e.g
ActiveSheet.Unprotect ("myPassword")
ActiveSheet.Protect ("myPassword")

or you can use a named parameter

ActiveSheet.Unprotect Password:="myPassword"
ActiveSheet.Protect Password:="myPassword"


--

Regards,
Nigel




"James C." wrote in message
...
Hi,

Hoping someone can help. I am trying to create a button that does the
following

1. Unprotects my excel sheet
2. Automatically inserts the unprotect password into the string so the
user
doesn't have to type it. Probably seems odd and a bad use of even having a
password but in the end it makes sense for what I am trying to do.

Right now I am using the following code to unprotect the sheet, but again
it
prompts me for the password instead of automatically inserting it in.

Activesheet.unprotect

Thanks for any help




Mike H

Unprotect Sheet with Password Included
 
Try

ActiveSheet.Unprotect Password:="xxx"
Mike

"James C." wrote:

Hi,

Hoping someone can help. I am trying to create a button that does the
following

1. Unprotects my excel sheet
2. Automatically inserts the unprotect password into the string so the user
doesn't have to type it. Probably seems odd and a bad use of even having a
password but in the end it makes sense for what I am trying to do.

Right now I am using the following code to unprotect the sheet, but again it
prompts me for the password instead of automatically inserting it in.

Activesheet.unprotect

Thanks for any help



Jim May

Unprotect Sheet with Password Included
 
With Sheet1
.Unprotect Password:="ABCD"
End With




"James C." wrote in message
...
Hi,

Hoping someone can help. I am trying to create a button that does the
following

1. Unprotects my excel sheet
2. Automatically inserts the unprotect password into the string so the
user
doesn't have to type it. Probably seems odd and a bad use of even having a
password but in the end it makes sense for what I am trying to do.

Right now I am using the following code to unprotect the sheet, but again
it
prompts me for the password instead of automatically inserting it in.

Activesheet.unprotect

Thanks for any help






All times are GMT +1. The time now is 02:23 AM.

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