A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can I protect all excel tabs in a file with one password entry?



 
 
Thread Tools Display Modes
  #31  
Old September 1st, 2009, 08:03 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Can I protect all excel tabs in a file with one password entry

These two macros are what you are using?

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

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

I see no reason why the unprotect won't work.


Gord Dibben MS Excel MVP

On Tue, 1 Sep 2009 10:16:02 -0700, 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?


  #32  
Old September 1st, 2009, 08:15 PM posted to microsoft.public.excel.misc
sld
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

if i used the protect all ws macroe, would that not put the same password on
all ws?

"Dave Peterson" wrote:

I'd bet that the password isn't really 123 for all the worksheets in the
workbook that contains the code.

Maybe you can add a line just to double check:

For Each ws In ThisWorkbook.Worksheets

msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws


That may give you a hint.


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

  #33  
Old September 1st, 2009, 08:25 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Can I protect all excel tabs in a file with one password entry

Depends on if that worked correctly and if anybody/any code changed the
password.

I'd still bet that the password isn't what you think.

SLD wrote:

if i used the protect all ws macroe, would that not put the same password on
all ws?

"Dave Peterson" wrote:

I'd bet that the password isn't really 123 for all the worksheets in the
workbook that contains the code.

Maybe you can add a line just to double check:

For Each ws In ThisWorkbook.Worksheets

msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws


That may give you a hint.


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


--

Dave Peterson
  #34  
Old September 1st, 2009, 08:34 PM posted to microsoft.public.excel.misc
sld
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

Where do I insert the line you sugest?

For Each ws In ThisWorkbook.Worksheets

msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws


"Dave Peterson" wrote:

Depends on if that worked correctly and if anybody/any code changed the
password.

I'd still bet that the password isn't what you think.

SLD wrote:

if i used the protect all ws macroe, would that not put the same password on
all ws?

"Dave Peterson" wrote:

I'd bet that the password isn't really 123 for all the worksheets in the
workbook that contains the code.

Maybe you can add a line just to double check:

For Each ws In ThisWorkbook.Worksheets
msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws

That may give you a hint.


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


--

Dave Peterson

  #35  
Old September 1st, 2009, 10:18 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Can I protect all excel tabs in a file with one password entry

right where I wrote it. Just above the line causing the trouble.

Then when/if the line fails, you'll remember the last worksheet name that was
shown to you. That's the one to check.

SLD wrote:

Where do I insert the line you sugest?

For Each ws In ThisWorkbook.Worksheets

msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws


"Dave Peterson" wrote:

Depends on if that worked correctly and if anybody/any code changed the
password.

I'd still bet that the password isn't what you think.

SLD wrote:

if i used the protect all ws macroe, would that not put the same password on
all ws?

"Dave Peterson" wrote:

I'd bet that the password isn't really 123 for all the worksheets in the
workbook that contains the code.

Maybe you can add a line just to double check:

For Each ws In ThisWorkbook.Worksheets
msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws

That may give you a hint.


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


--

Dave Peterson


--

Dave Peterson
  #36  
Old September 2nd, 2009, 01:38 PM posted to microsoft.public.excel.misc
sld
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

This is working, but when you have over 100 tabs it is hard to keep track of
when the last mesege box is going to error out on me. Is there a line that
I can enter that will give me a report that i can clearly see what was the
last tab, or can it take me to the tab that does not have the correct
password?

"Dave Peterson" wrote:

right where I wrote it. Just above the line causing the trouble.

Then when/if the line fails, you'll remember the last worksheet name that was
shown to you. That's the one to check.

SLD wrote:

Where do I insert the line you sugest?

For Each ws In ThisWorkbook.Worksheets

msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws


"Dave Peterson" wrote:

Depends on if that worked correctly and if anybody/any code changed the
password.

I'd still bet that the password isn't what you think.

SLD wrote:

if i used the protect all ws macroe, would that not put the same password on
all ws?

"Dave Peterson" wrote:

I'd bet that the password isn't really 123 for all the worksheets in the
workbook that contains the code.

Maybe you can add a line just to double check:

For Each ws In ThisWorkbook.Worksheets
msgbox "Processing: " & ws.name
ws.Unprotect Password:="123"
Next ws

That may give you a hint.


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


--

Dave Peterson


--

Dave Peterson

  #37  
Old September 2nd, 2009, 01:54 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Can I protect all excel tabs in a file with one password entry

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
  #38  
Old September 2nd, 2009, 04:28 PM posted to microsoft.public.excel.misc
sld
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

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

  #39  
Old September 16th, 2009, 07:00 PM posted to microsoft.public.excel.misc
sld
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

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

  #40  
Old September 16th, 2009, 07:48 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-User vs Client/Server GeorgieGirl General Discussion 3 June 8th, 2005 11:42 PM
how do i open password protect word file if forgot password? chandraprakash General Discussion 1 November 9th, 2004 02:20 PM
Automatically Updating Excel Data In Word Doc Inside Excel File Business Design Architect General Discussion 0 August 29th, 2004 10:55 PM
decipher log of scanpst.exe km General Discussion 0 July 18th, 2004 09:00 AM
Unsafe Attachments Ron Installation & Setup 2 June 9th, 2004 01:55 AM


All times are GMT +1. The time now is 08:20 AM.


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