ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password setting syntax (https://www.excelbanter.com/excel-programming/352844-password-setting-syntax.html)

Dave[_54_]

Password setting syntax
 
Hi,
I'm trying to write code that protects the active sheet, using a password
(eg: dave)
I've tried:

ActiveSheet.Protect (dave)

and

ActiveSheet.Protect Password:=dave

Both these lines of code protect the sheet, but allow it to be unprotected
without prompting for the password

I'm using XL2000, and can't find it in the VBA help.

Regards - Dave



Jim Cone

Password setting syntax
 
Dave,

The Protect method requires a string for the password...
ActiveSheet.Protect "dave"

Also, if you enter "Option Explicit" (without the quote marks)
as the first line in the module it will flag such mistakes.

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Dave" wrote in message
Hi,
I'm trying to write code that protects the active sheet, using a password
(eg: dave)
I've tried:

ActiveSheet.Protect (dave)
and
ActiveSheet.Protect Password:=dave

Both these lines of code protect the sheet, but allow it to be unprotected
without prompting for the password
I'm using XL2000, and can't find it in the VBA help.
Regards - Dave

Dave[_54_]

Password setting syntax
 
Hi Jim
Thanks for that - works a treat
Dave.

"Jim Cone" wrote in message
...
Dave,

The Protect method requires a string for the password...
ActiveSheet.Protect "dave"

Also, if you enter "Option Explicit" (without the quote marks)
as the first line in the module it will flag such mistakes.

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Dave" wrote in message
Hi,
I'm trying to write code that protects the active sheet, using a password
(eg: dave)
I've tried:

ActiveSheet.Protect (dave)
and
ActiveSheet.Protect Password:=dave

Both these lines of code protect the sheet, but allow it to be unprotected
without prompting for the password
I'm using XL2000, and can't find it in the VBA help.
Regards - Dave





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

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