View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Alsop Mark Alsop is offline
external usenet poster
 
Posts: 3
Default Excel 2003 changes protection when saving

No takers on this one?

Well it seems to be a bug in Excel 2003, and it is reproduceable! Since the
problem only appears when reloading a saved sheet after it has had
protection turned off and on again the workaround was to install an
Auto_Open macro that that iterates through the worksheets and resets the
security before the user can begin working with the workbook. The following
code does the trick...

Dim oWS As Worksheet

' Block Screen Updates
Application.ScreenUpdating = False


For Each oWS In Worksheets

If InStr(1, oWS.Name, "Quarter", vbBinaryCompare) Then

' Select the sheet
Sheets(oWS.Name).Select

' Reset protection on the Quarter Sheets to fix bug in Excel
2003
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells

End If

Next ' oWS

' Open with the first sheet
Sheets("1st Quarter").Select

' Restore Screen Updates
Application.ScreenUpdating = True