View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default disable "unprotect sheet" in tools menu bar with VB

I am not saying don't do it but it is a whole pile easier to password protect
the sheet than it is to effectively disable the menu item. The problem is not
with disabling the menu item. It is ensuring that you reset it appropriately.
You need to determine when the book opens, is activated, deactivated, or
closed and set the item appropriately. And all of this assumes that macros
are enabled. If they are not then you can not enable/disable the item...

If you still want to do this then you need to look at the events I listed in
ThisWorkbook and add the appropriate code to those events. Also note that the
end user could have placed a protect/unportect button directly onto one of
their toolbars so you will want/need to search through all open toolbars
looking for this button.

I personally would just add a password. Note that if you want to break the
password on a sheet that can be done with very simple code in about 2
minutes...
--
HTH...

Jim Thomlinson


"Mary Cullen" wrote:

In my VB code I want to disable the "unprotect sheet" command in
tools/protection. I am trying to avoid password protecting the sheet