ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password protection (https://www.excelbanter.com/excel-programming/359373-password-protection.html)

Nick Smith[_2_]

Password protection
 
Can anyone help me write 2 macros to turn on and turn off password
protection? I want to be able to add these to macros I already have so that
the user doesn't get the enter password screen. For arguments sake, the
password is "monkey".

Thanks,

Nick

Ivan Raiminius

Password protection
 
Hi Nick,

sub Unprotect
dim ws as worksheet
for each ws in activeworkbook.worksheets
ws.unprotect "monkey"
next ws
end sub

sub Protect
dim ws as worksheet
for each ws in activeworkbook.worksheets
ws.protect "monkey"
next ws
end sub

Regards,
Ivan


Nick Smith[_2_]

Password protection
 
That's great, thanks Ivan.

"Ivan Raiminius" wrote:

Hi Nick,

sub Unprotect
dim ws as worksheet
for each ws in activeworkbook.worksheets
ws.unprotect "monkey"
next ws
end sub

sub Protect
dim ws as worksheet
for each ws in activeworkbook.worksheets
ws.protect "monkey"
next ws
end sub

Regards,
Ivan




All times are GMT +1. The time now is 07:00 PM.

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