Protect Sheet with password through VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
one way:

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

JE McGimpsey said:
one way:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top