ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect Sheet with password through VBA (https://www.excelbanter.com/excel-programming/319534-protect-sheet-password-through-vba.html)

bill_morgan_3333

Protect Sheet with password through VBA
 
Is there a way to protect and unprotect (with a password) an Excel 2000 sheet
through VBA? I know the syntax for doing this without a password, but can it
be done with a password?

Thanks ...

Bill Morgan


JE McGimpsey

Protect Sheet with password through VBA
 
one way:

Const sPWORD As String = "drowssap"
Sheets("Sheet1").Protect Password:=sPWORD
Sheets("Sheet1").Unprotect Password:=sPWORD


In article ,
"bill_morgan_3333" wrote:

Is there a way to protect and unprotect (with a password) an Excel 2000 sheet
through VBA? I know the syntax for doing this without a password, but can it
be done with a password?

Thanks ...

Bill Morgan


bill_morgan_3333

Protect Sheet with password through VBA
 
Perfect. Thank you ...

"JE McGimpsey" wrote:

one way:

Const sPWORD As String = "drowssap"
Sheets("Sheet1").Protect Password:=sPWORD
Sheets("Sheet1").Unprotect Password:=sPWORD


In article ,
"bill_morgan_3333" wrote:

Is there a way to protect and unprotect (with a password) an Excel 2000 sheet
through VBA? I know the syntax for doing this without a password, but can it
be done with a password?

Thanks ...

Bill Morgan




All times are GMT +1. The time now is 08:25 AM.

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