How to Unlock Worksheets with a Macro?

S

Storm

Good morning. A couple of weeks ago, someone from this forum, was very
helpful in my question on how to unprotect protected worksheets, with similar
passwords, with a macro. Below is a copy of the VB script I was given. It
worked but then I realized, the password "hi" is now visible under the macro
script. Is there a way to rewrite the code so that it will not show the
password and instead when the macro is run, one has to enter the password
before the macro can unprotect the protected worksheets?

thank you very much,
Storm

Option Explicit
sub testme()
dim myPWD as string
dim wks as worksheet
myPWD = "hi"
for each wks in activeworkbook.worksheets
wks.unprotect password:=mypwd
next wks
end sub
 
D

Dave Peterson

Check your other post.

It's not necessary to post the same question to multiple newsgroups. But if you
think you must, then instead of multiposting (the same/similar question sent to
individual groups), you could crosspost (single question sent once to all the
groups).
 
S

Storm

Will do. Wasn't getting any hits initially...so I thought if someone was
responding more under the other forum, I'd give it a try.
 
D

Dave Peterson

The bad news is that if you do this, it usually ticks people off--they've wasted
their time since you have an answer somewhere else.

And you have multiple spots to check, so it can waste your time, too.

But worst is that you don't get as many answers that build on a previous
response--since the responses can be in several newsgroups.
 
P

Peo Sjoblom

Plus when regulars notice that there are multiple posts many stop paying
attention to all posts from this poster (at least I do that)


--


Regards,


Peo Sjoblom
 

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

Top