View Single Post
  #40   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Can I protect all excel tabs in a file with one password entry

What are you trying to achieve?

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
Dim pword as String
pword = InputBox("Enter a password to run this macro")
If pword < "drowssap" Then Exit Sub
For N = 1 To Sheets.Count
Sheets(N).Unprotect Password:="123"
Next N
Application.ScreenUpdating = True
End Sub

Now you should lock the project from view.

Select workbook/project in VBE and Right-ClickVBAProject
PropertiesProtection.

Lock and enter a unique password.

Do not forget this password..................you now have three different
passwords.

sheet protect...............123
inputbox...........drowssap
project properties...............unique word


Gord


On Wed, 16 Sep 2009 11:00:01 -0700, SLD
wrote:

Is there a way to request a pasword to run the macroes?

"SLD" wrote:

Thanks so much. That worked. it helped me identify which tabs did have a
different password. This is a big help to me.

"Dave Peterson" wrote:

Option Explicit
Sub Unprotect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
On Error Resume Next
ws.Unprotect Password:="123"
On Error GoTo 0
If ws.ProtectContents _
Or ws.ProtectDrawingObjects _
Or ws.ProtectScenarios Then
MsgBox ws.Name & " is still protected"
End If
Next ws
End Sub

SLD wrote:

I copied the unprotect macroe

Sub Unprotect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="123"
Next ws
End Sub

and it is still giving me an error on the 4th line. the passwords are the
same on both macroes.

What am I doing wrong?

--

Dave Peterson