Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Excel bug with sheet protection, user interface only??

Hi,

I want to allow users to protect a sheet not for security
reasons but rather to avoid unintentional overwrites. But
VBA should still be allowed to modify the sheet (used to
refresh some data in a spreadsheet while protecting the
criteria from unintentional modification).

I call WorkSheet.Protect(pwd, UserInterfaceOnly:=True) and
it works like a dream - for the remainder of the session.
I save, close Excel and start a new instance, load the
saved workbook and... now the sheet has "normal"
protection and VBA is NOT allowed to make modifications.

Does anyone know if this is a bug in Excel and/or how to
overcome the problem?

Help greatly appreciated! Regards,

Dag Johansen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel bug with sheet protection, user interface only??

No, it isn't a bug - it is the designed behavior. Settings such as this and
scrollarea, enableautofilter, enableselection and enableoutline are
temporary and are not retain when the workbook is closed.

You need to use the workbook_Open event or other appropriate event to set
them so they are in effect when the workbook is opened.

--
Regards,
Tom Ogilvy


"Dag Johansen" wrote in message
...
Hi,

I want to allow users to protect a sheet not for security
reasons but rather to avoid unintentional overwrites. But
VBA should still be allowed to modify the sheet (used to
refresh some data in a spreadsheet while protecting the
criteria from unintentional modification).

I call WorkSheet.Protect(pwd, UserInterfaceOnly:=True) and
it works like a dream - for the remainder of the session.
I save, close Excel and start a new instance, load the
saved workbook and... now the sheet has "normal"
protection and VBA is NOT allowed to make modifications.

Does anyone know if this is a bug in Excel and/or how to
overcome the problem?

Help greatly appreciated! Regards,

Dag Johansen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Excel bug with sheet protection, user interface only??

Hi Tom,

thanks a lot for quick response. I have a follow-up
question then...

Not all sheets should necessarily be protected. The user
can choose to protect the active sheet on a custom menu
much like the normal protection, is prompted for an
(optional) password and then the Protect method is called.

My question is: In order to use the Workbook_Open
workaround, how would you recommend I persist the settings
for the sheets, so in the event handler I can make the
call to protect if and only if the user did indeed protect
it? (I wouldn't like to have to capture and handle events
such as renaming, reordering, deleting or inserting sheets
in the workbook.)

Happy coding,

Dag
-----Original Message-----
No, it isn't a bug - it is the designed behavior.

Settings such as this and
scrollarea, enableautofilter, enableselection and

enableoutline are
temporary and are not retain when the workbook is closed.

You need to use the workbook_Open event or other

appropriate event to set
them so they are in effect when the workbook is opened.

--
Regards,
Tom Ogilvy


"Dag Johansen" wrote in message
...
Hi,

I want to allow users to protect a sheet not for

security
reasons but rather to avoid unintentional overwrites.

But
VBA should still be allowed to modify the sheet (used to
refresh some data in a spreadsheet while protecting the
criteria from unintentional modification).

I call WorkSheet.Protect(pwd, UserInterfaceOnly:=True)

and
it works like a dream - for the remainder of the

session.
I save, close Excel and start a new instance, load the
saved workbook and... now the sheet has "normal"
protection and VBA is NOT allowed to make modifications.

Does anyone know if this is a bug in Excel and/or how to
overcome the problem?

Help greatly appreciated! Regards,

Dag Johansen



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel bug with sheet protection, user interface only??

You can test each sheet to see if it is protected.

for each sh in thisworkbook.worksheets
if sh.protectContents then
sh.Activate
sh.protect UserInterfaceOnly:=True
End if
Next

In xl2000 and earlier, you can apply UserInterfaceOnly without knowing the
password. I understand you need to supply the password in xl2002 (and
assume xl2003). I am not sure how you intend to do that other than prompt
the user .

--
Regards,
Tom Ogilvy



"Dag Johansen" wrote in message
...
Hi Tom,

thanks a lot for quick response. I have a follow-up
question then...

Not all sheets should necessarily be protected. The user
can choose to protect the active sheet on a custom menu
much like the normal protection, is prompted for an
(optional) password and then the Protect method is called.

My question is: In order to use the Workbook_Open
workaround, how would you recommend I persist the settings
for the sheets, so in the event handler I can make the
call to protect if and only if the user did indeed protect
it? (I wouldn't like to have to capture and handle events
such as renaming, reordering, deleting or inserting sheets
in the workbook.)

Happy coding,

Dag
-----Original Message-----
No, it isn't a bug - it is the designed behavior.

Settings such as this and
scrollarea, enableautofilter, enableselection and

enableoutline are
temporary and are not retain when the workbook is closed.

You need to use the workbook_Open event or other

appropriate event to set
them so they are in effect when the workbook is opened.

--
Regards,
Tom Ogilvy


"Dag Johansen" wrote in message
...
Hi,

I want to allow users to protect a sheet not for

security
reasons but rather to avoid unintentional overwrites.

But
VBA should still be allowed to modify the sheet (used to
refresh some data in a spreadsheet while protecting the
criteria from unintentional modification).

I call WorkSheet.Protect(pwd, UserInterfaceOnly:=True)

and
it works like a dream - for the remainder of the

session.
I save, close Excel and start a new instance, load the
saved workbook and... now the sheet has "normal"
protection and VBA is NOT allowed to make modifications.

Does anyone know if this is a bug in Excel and/or how to
overcome the problem?

Help greatly appreciated! Regards,

Dag Johansen



.



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
User Interface Basics -- Have we begun to regress? gary7 Excel Discussion (Misc queries) 1 April 14th 09 12:38 AM
Creating a user interface form Thi Navy Excel Discussion (Misc queries) 1 September 21st 08 08:28 PM
Multilingual User Interface Pack for excel 2007 [email protected] Excel Discussion (Misc queries) 0 April 16th 07 07:20 AM
2007 User Interface Bob P Excel Discussion (Misc queries) 10 February 21st 07 02:11 PM
User Interface mickeyblake Excel Programming 2 July 15th 03 09:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"