User chooses their workbooks and as they open, a sub
(VlnSearchAndProtect) is called, and acts on each sheet
in each book, in turn. I'm fairly sure it's working.
I need to allow users the facility to unprotect (most)
sheets/books which they have opened (and on which
that sub has operated). So I have a little routine which
does that.
There is then the need to reprotect the open books and
sheets. So I have this routine:
Sub AddProtection() 'All sheets in all open Workbooks
Dim ws As Worksheet, wkbk As Workbook
Application.ScreenUpdating = False
For Each wkbk In Workbooks
Application.ScreenUpdating = False
With wkbk
.Activate
'set the level of protection appropriate
'to each type of workbook and sheet
Call VlnSearchAndProtect
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws
.Protect
.EnableSelection = xlUnlockedCells
End With
Next
End With
Next
Application.ScreenUpdating = True
End Sub
The protection 'appears' to be set by the Protect
routine, but not the Unlocked cells.
Can you help, please?
Regards.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.700 / Virus Database: 457 - Release Date: 06/06/2004