Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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
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 Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
How to Link on [Sheet(1) Window(1)] to [Sheet(2) Window(2)] ? EagleOne Excel Discussion (Misc queries) 0 November 22nd 06 03:48 PM
The window opens in a smaller window not full sized window. Rachael Excel Discussion (Misc queries) 0 November 7th 06 09:04 PM
Sheet protection error msg - Unrequested sheet activation deltree[_3_] Excel Programming 0 January 28th 04 06:20 PM


All times are GMT +1. The time now is 11:44 AM.

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"