protect sheet macro - can't have it enter password

  • Thread starter Thread starter inaz
  • Start date Start date
I

inaz

Simple problem I think.

I record a macro to protect a sheet and enter the password durin
recording. However, when I play the macro, the sheet is protected bu
it is not password protected. It can be unprotected without entering
password.

Why isn't the password part of the macro? And how do I get it in ther
????
 
Replace a line in your code that would be similar to this


To Protect an active sheet

ActiveSheet.Protect PASSWORD:="Password Phrase Here",
DrawingObjects:=True, Contents:=True, Scenarios:=True

To Unprotect an active sheet

ActiveSheet.Unprotect PASSWORD:="Password Phrase Here"
 
inaz,

Why it doesn't record the password, I couldn't tell ya'
Go into the VBA editor and add the following to the recorded line:
, password:="yourpassword"

The whole line should read something like this:
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
password:="yourpassword"

John
 

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