Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default How to Unlock Worksheets with a Macro?

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default How to Unlock Worksheets with a Macro?

myPWD =Application.Inputbox("Enter Password: ")
--
Gary''s Student - gsnu200745


"Storm" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to Unlock Worksheets with a Macro?

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).



Storm wrote:

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


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default How to Unlock Worksheets with a Macro?

Perfect! Thank you very much!

"Gary''s Student" wrote:

myPWD =Application.Inputbox("Enter Password: ")
--
Gary''s Student - gsnu200745


"Storm" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default How to Unlock Worksheets with a Macro?

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.

"Dave Peterson" wrote:

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).



Storm wrote:

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


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to Unlock Worksheets with a Macro?

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.



Storm wrote:

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.

"Dave Peterson" wrote:

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).



Storm wrote:

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


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default How to Unlock Worksheets with a Macro?

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




"Dave Peterson" wrote in message
...
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.



Storm wrote:

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.

"Dave Peterson" wrote:

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).



Storm wrote:

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

--

Dave Peterson


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Macro for all worksheets saman110 via OfficeKB.com Excel Worksheet Functions 2 July 23rd 07 10:27 PM
How to Unlock K New Users to Excel 4 February 2nd 07 09:45 PM
Same macro - Different Worksheets!? PaulW Excel Discussion (Misc queries) 2 December 12th 06 11:55 AM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM
How do i unlock protected worksheets? jamesbialek Excel Worksheet Functions 1 June 22nd 05 01:02 PM


All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"