Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
pop up window and protection of sheet
When protecting, try setting UserInterfaceOnly to True. This means that the
code can run free in the background -- JNW "caroline" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
pop up window and protection of sheet
I need to unprotect the sheet to do certain manipulations with VBA
The purpose of the UserInterfaceOnly parameter is to make that unnecessary. So try setting that to True before going any farther. UserInterfaceOnly:=True is not effective for every macro action however so if it is still necessary to unprotect the sheet (and if the real problem with re-protecting the sheet is that the formerly active sheet is no longer the active sheet) revise your code along these lines: Dim CurrSheet as Worksheet Set CurrSheet = ActiveSheet CurrSheet.Unprotect password:="password" | .... | lots of VBA lines | ... | 'pop up window for graph CurrSheet.ChartObjects(3).Activate ActiveChart.ChartArea.Select ActiveChart.ShowWindow = True CurrSheet.Protect ...etc. -- Jim "caroline" wrote in message ... | 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Data Protection Best Practice: AKA: Real Sheet Protection | Excel Discussion (Misc queries) | |||
Excel Data Protection- AKA: Sheet/Macro Password Protection | Setting up and Configuration of Excel | |||
How to Link on [Sheet(1) Window(1)] to [Sheet(2) Window(2)] ? | Excel Discussion (Misc queries) | |||
The window opens in a smaller window not full sized window. | Excel Discussion (Misc queries) | |||
Sheet protection error msg - Unrequested sheet activation | Excel Programming |