View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Caroline Caroline is offline
external usenet poster
 
Posts: 183
Default pop up window and protection of sheet

Hi,
I have a sheet with various data and graphs that is protected by a VBA
program when the sheet is activated:
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, password:="password", DrawingObjects:=True,
UserInterfaceOnly:=False
End With

The problem is the following:
I need to unprotect the sheet to do certain manipulations with VBA before I
get to display a graph using pop windows (the graphs are also locked by
protection). The problem is that when the user close the pop up window, the
sheet is unprotected. (writing the protection code underneath the popup
window code does not work. I think that the sheet is not recognised as active
anymore. and as I need this to work on several sheets, regardless of their
names, I cannot use the sheet name in the protection code)

'unprotect sheet
ActiveSheet.Unprotect password:="password"
.....
lots of VBA lines
....
'pop up window for graph
ActiveSheet.ChartObjects(3).Activate
ActiveChart.ChartArea.Select
ActiveChart.ShowWindow = True

Any idea very welcome.
Thanks


--
caroline