Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 202
Default How to lock several sheets including af password?

Sooner I have asked for an easy way to lock all the sheets in a spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to lock several sheets including af password?

That second set of instructions is to protect the workbook's project so that the
users can't see the code (and any included password).

If you want to protect each sheet with the same password, you could use:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
password:="topsecret"
Next ws
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect password:="topsecret"
Next ws
End Sub

But if the user knows how to get the the VBE, they can read your code and see
the password. That's where the project protection comes in.

ps. Change "topsecret" to your password in both spots.

Jane wrote:

Sooner I have asked for an easy way to lock all the sheets in a spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default How to lock several sheets including af password?

Hi
Jane

Try
Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
Password:="Roger"
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect Password:="Roger"
Next
End Sub


Make the password something far more sensible and memorable than "Roger"

--
Regards
Roger Govier



"Jane" wrote in message
...
Sooner I have asked for an easy way to lock all the sheets in a spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to lock several sheets including af password?

Tyop <bg alert.

ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
Password:="Roger"

(Added a comma after the last True in the first line.)



Roger Govier wrote:

Hi
Jane

Try
Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
Password:="Roger"
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect Password:="Roger"
Next
End Sub

Make the password something far more sensible and memorable than "Roger"

--
Regards
Roger Govier

"Jane" wrote in message
...
Sooner I have asked for an easy way to lock all the sheets in a spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 202
Default How to lock several sheets including af password?

Thanks!!
--
Jane


"Dave Peterson" skrev:

Tyop <bg alert.

ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
Password:="Roger"

(Added a comma after the last True in the first line.)



Roger Govier wrote:

Hi
Jane

Try
Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
Password:="Roger"
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect Password:="Roger"
Next
End Sub

Make the password something far more sensible and memorable than "Roger"

--
Regards
Roger Govier

"Jane" wrote in message
...
Sooner I have asked for an easy way to lock all the sheets in a spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default How to lock several sheets including af password?

Glad you are alert Dave, (as always!!)

In the middle of setting up my new Dell laptop with Vista. Typing on the
wrong keyboard half of the time! Well, that's my excuse, anyway.

--
Regards
Roger Govier



"Dave Peterson" wrote in message
...
Tyop <bg alert.

ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
Password:="Roger"

(Added a comma after the last True in the first line.)



Roger Govier wrote:

Hi
Jane

Try
Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
Password:="Roger"
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect Password:="Roger"
Next
End Sub

Make the password something far more sensible and memorable than "Roger"

--
Regards
Roger Govier

"Jane" wrote in message
...
Sooner I have asked for an easy way to lock all the sheets in a
spredsheet
and I got the very useful answer:

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

But I like to protect my spredsheet with a password, so the user can't
remove the protection. To that question I got the following answer:

"Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection"

But I can't make that work - why?

Jane


--

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
How do I lock several sheets Jane Excel Discussion (Misc queries) 4 November 23rd 07 01:11 PM
How to password / lock a folder instead of each files Babu Joseph Excel Discussion (Misc queries) 8 July 16th 07 06:32 PM
Password Access to certain sheets Sheryl Excel Worksheet Functions 2 November 28th 06 09:39 PM
I FORGOT MY PASSWORD AND THE EXCEL SHEET IS LOCK HOW CAN I UNLOCK Asaf Excel Discussion (Misc queries) 1 October 4th 06 02:50 AM
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) RICHARD Excel Worksheet Functions 1 March 15th 05 05:49 PM


All times are GMT +1. The time now is 01:49 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"