Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / September 2007

Tip: Looking for answers? Try searching our database.

How to Unlock Worksheets with a Macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Storm - 17 Sep 2007 16:46 GMT
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
Gary''s Student - 17 Sep 2007 17:10 GMT
myPWD =Application.Inputbox("Enter Password: ")
Signature

Gary''s Student - gsnu200745

> 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
[quoted text clipped - 16 lines]
>   next wks
> end sub
Storm - 17 Sep 2007 17:30 GMT
Perfect!  Thank you very much!

> myPWD =Application.Inputbox("Enter Password: ")
>
[quoted text clipped - 18 lines]
> >   next wks
> > end sub
Dave Peterson - 17 Sep 2007 17:25 GMT
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).

> 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
[quoted text clipped - 16 lines]
>   next wks
> end sub

Signature

Dave Peterson

Storm - 17 Sep 2007 17:36 GMT
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.

> Check your other post.
>
[quoted text clipped - 23 lines]
> >   next wks
> > end sub
Dave Peterson - 17 Sep 2007 17:46 GMT
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.

> 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.
[quoted text clipped - 30 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Peo Sjoblom - 17 Sep 2007 17:49 GMT
Plus when regulars notice that there are multiple posts many stop paying
attention to all posts from this poster (at least I do that)

Signature

Regards,

Peo Sjoblom

> The bad news is that if you do this, it usually ticks people off--they've
> wasted
[quoted text clipped - 48 lines]
>> >
>> > Dave Peterson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.