Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Password Protection set for all worksheets

Hi,

I need code to re-set the password on all my sheets within a workbook if the
user forgets to re-set it.

I am currently using a single 'ActiveSheet' code, but as I have added more
sheets need code to re-set on all sheets....my sheets do need to allow users
to input to unlocked cells.....am using this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect Password:="MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Thanks

Craig

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Password Protection set for all worksheets

HI Craig
Try this one

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each sh in ThisWorkbook.Sheets
sh.Protect Password:="MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Next
End Sub

Regards,
Per

On 31 Jan., 19:59, Craig wrote:
Hi,

I need code to re-set the password on all my sheets within a workbook if the
user forgets to re-set it.

I am currently using a single 'ActiveSheet' code, but as I have added more
sheets need code to re-set on all sheets....my sheets *do need to allow users
to input to unlocked cells.....am using this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect Password:="MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Thanks

Craig


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Password Protection set for all worksheets

Yet again Per, first class code in such a quick time......Works perfectly

Many Thanks

Craig

"Per Jessen" wrote:

HI Craig
Try this one

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each sh in ThisWorkbook.Sheets
sh.Protect Password:="MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Next
End Sub

Regards,
Per

On 31 Jan., 19:59, Craig wrote:
Hi,

I need code to re-set the password on all my sheets within a workbook if the
user forgets to re-set it.

I am currently using a single 'ActiveSheet' code, but as I have added more
sheets need code to re-set on all sheets....my sheets do need to allow users
to input to unlocked cells.....am using this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect Password:="MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Thanks

Craig


.

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
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Password Protection for Individual Worksheets ??? Gina M Excel Worksheet Functions 3 September 11th 08 05:31 PM
Password Protection for Worksheets already protected Kristi Excel Worksheet Functions 16 December 1st 07 07:22 PM
Worksheets with password protection Judy Bryant Excel Worksheet Functions 4 November 10th 06 03:09 PM
Cell Password Protection-Multiple Worksheets GW Trainer Excel Worksheet Functions 0 May 19th 05 07:58 PM


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