Macro to type in worksheet password

Lynnette

New Member
Joined
Apr 1, 2009
Messages
7
I am trying to create a macro that will allow me to unprotect a password protected worksheet. I do not want the password to show in the macro itself except as *s. I know I have seen this discussed somewhere I just can't remember where.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi Lynnette

Welcome to the Board

Do you mean setting the password character to * or something else in a text box? If so you need to look in Properties for PasswordChar and set it to your desired character

HTH


Dave
 
Upvote 0
I wanted to be able to type in a normal password, but if you read the documentation for the macro, the actual password would not show in the macro, only * or other characters.
 
Upvote 0
Can you show the documentation please?
 
Upvote 0
Hi Lynnette

Welcome to the Board

Do you mean setting the password character to * or something else in a text box? If so you need to look in Properties for PasswordChar and set it to your desired character

HTH


Dave
What I am trying to do is type the actual password in, but when you look at the macro itself, the actual password is not there just *s or other characters.
 
Upvote 0
Can you show the documentation please?
Sub Macro1()
Here is the docuemntation for one we created, we are working on another right now and do not want the password in the documentation.

' Macro1 Macro
' Macro recorded 2/4/2009 by Robert Ragusin
'
'
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Next.Select
ActiveSheet.Unprotect Password:="checks"
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select


End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/4/2009 by Robert Ragusin
'
'
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Next.Select
ActiveSheet.Protect "checks"
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select

End Sub
 
Upvote 0
Right

Code:
Sub UnProAll()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
    sh.Unprotect "Password"
Next sh
End Sub

And Protect to do the reverse as for not having the password in the code, this is not possible as far as I am aware, you should protect the VBA Project to hide the password
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top