Kioskea
Recherche
Ask a question Report

Excel Macro; Adding Password [Solved/Closed]

zeromaim 10Posts Monday July 28, 2008Registration date August 8, 2008Last seen - Latest answer on Mar 13, 2013 10:39AM
Hello,
Hope you anyone can help me with this...
I need to create a macro that unlocks a password-protected sheet with password "password", do some instruction, then locks it again with same password.
Thanks in advance for any assistance.
zero
Read more 
Answer
+14
moins plus
Hello zero,
the syntax is quite simple
ActiveSheet.Unprotect ("MyPassWord")
'instructions
ActiveSheet.Protect ("MyPassWord")

for more details, I suggest you type "worksheet.protect" and "worksheet.unprotect" in the help file of visual basic editor.
Ivan

zeromaim 10Posts Monday July 28, 2008Registration date August 8, 2008Last seen - Aug 6, 2008 07:22AM
Hi Ivan,

Thanks for this, and other one as well.
I'm not actually a programer. I self-studied excel and i'm good at using formulas.
I just recently learn about macro and I used to just for recording to eliminate the circular ref error with formulas.
I was glad to have found this site and have read one of your response.

Thanks,

Anton
DaveyBoy- Oct 7, 2008 12:29PM
The ActiveSheet.Protect ("MyPassWord") works, but what if you want the set certain "abilities" to True when assigning the password as in the following code.

ActiveSheet.Protect ("MyPassWord") DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True

This errors out when the Macro is ran. Is there a different Syntax for a case like this?
Ivan-hoe 436Posts Saturday February 16, 2008Registration date October 17, 2008Last seen - Oct 8, 2008 06:46AM
Hello,
try this syntax :
ActiveSheet.Protect PassWord:="MyPassWord", DrawingObjects:=True,  _ 
Contents:=True,  Scenarios:=True, AllowSorting:=True, AllowFiltering:=True,  _ 
AllowUsingPivotTables:=True 

Ivan
Josh- Sep 9, 2009 07:12AM
Hey Ivan valuable info on your post. Thanks pal.
Abbi- Sep 17, 2010 01:28AM
thanks Ivan...ur post was a real help :)
Answer
+1
moins plus
Thanks Ivan.

How do I change the status of this topic to "resolved"?

Anton

aquarelle 7076Posts dimanche 8 avril 2007Registration date ModeratorStatus October 20, 2014Last seen - Aug 8, 2008 03:30PM
Hi,
Go to the top of your thread (to the right part), and check the case "solved" after click on "OK"
Best regards
Answer
+1
moins plus
Thanks Ivan!

Ram's- Jul 28, 2010 08:23AM
i want those number in front add ''0" (Zero) how to 456789
11111
22222
33333
rizvisa1 4302Posts Thursday January 28, 2010Registration date ContributorStatus December 6, 2014Last seen - Jul 28, 2010 10:14AM
Ram: what this question "i want those number in front add ''0" (Zero) how to 456789 11111 22222 33333", has to do with the thread ?
Answer
+0
moins plus
how to remove the xsl sheet password

Answer
+0
moins plus
Tnx for this :) this is working for me :)

This document entitled « Excel Macro; Adding Password » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.

Not a member yet?

sign-up, it takes less than a minute and it's free!

Members get more answers than anonymous users.

Being a member gives you detailed monitoring of your requests.

Being a member gives you additional options.