Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Disable Tools Protection

Thanks to a post from Ron de Bruin I found the following to disable the Tools
Protection option from the tool bar:


Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=30029, Recursive:=True).Enabled = False

My question is where do I insert this code? Is it in the "This Workbook"
portion of the code? I gave that a try, but nothing happened.

I have protected all the cells where I do not want the user to change a
formula. However, if they try to change a formula they get the Excel message
box that advises them the cell is protected, then tells them how to go
unprotect the worksheet.

At first I password protected the sheet, but then my macro wouldn't run. I
was unsuccessful in writting code to unprotect, run the macro, then protect
the sheet. So, I decided to try just removing the toolsProtection option
from the menu so the user will not have any easy time unprotecting the sheet
and changing formulas.

If anyone has a better solution, please advise.

Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Disable Tools Protection

Hi Tim

Use this two events in the Thisworkbook module.

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_Activate()
'your code to change Enabled to False
'Or the name of your macro
End Sub

Private Sub Workbook_Deactivate()
'your code to change Enabled to True
'Or the name of your macro
End Sub

If you want to use your macro to protect and unprotect

Then use it like this (ron is the password)

Sub test()
With Sheets("Sheet1")
.Unprotect "ron"
.Range("B1").Value = "Hi"
.Protect "ron"
End With
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl



"TimN" wrote in message ...
Thanks to a post from Ron de Bruin I found the following to disable the Tools
Protection option from the tool bar:


Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=30029, Recursive:=True).Enabled = False

My question is where do I insert this code? Is it in the "This Workbook"
portion of the code? I gave that a try, but nothing happened.

I have protected all the cells where I do not want the user to change a
formula. However, if they try to change a formula they get the Excel message
box that advises them the cell is protected, then tells them how to go
unprotect the worksheet.

At first I password protected the sheet, but then my macro wouldn't run. I
was unsuccessful in writting code to unprotect, run the macro, then protect
the sheet. So, I decided to try just removing the toolsProtection option
from the menu so the user will not have any easy time unprotecting the sheet
and changing formulas.

If anyone has a better solution, please advise.

Thanks!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Disable Tools Protection

Ron,

Thanks!!! I got rid of the tools protection option. I am going to work
with the code for the password. May have to get back with you on that with
more questions.


"Ron de Bruin" wrote:

Hi Tim

Use this two events in the Thisworkbook module.

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_Activate()
'your code to change Enabled to False
'Or the name of your macro
End Sub

Private Sub Workbook_Deactivate()
'your code to change Enabled to True
'Or the name of your macro
End Sub

If you want to use your macro to protect and unprotect

Then use it like this (ron is the password)

Sub test()
With Sheets("Sheet1")
.Unprotect "ron"
.Range("B1").Value = "Hi"
.Protect "ron"
End With
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl



"TimN" wrote in message ...
Thanks to a post from Ron de Bruin I found the following to disable the Tools
Protection option from the tool bar:


Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=30029, Recursive:=True).Enabled = False

My question is where do I insert this code? Is it in the "This Workbook"
portion of the code? I gave that a try, but nothing happened.

I have protected all the cells where I do not want the user to change a
formula. However, if they try to change a formula they get the Excel message
box that advises them the cell is protected, then tells them how to go
unprotect the worksheet.

At first I password protected the sheet, but then my macro wouldn't run. I
was unsuccessful in writting code to unprotect, run the macro, then protect
the sheet. So, I decided to try just removing the toolsProtection option
from the menu so the user will not have any easy time unprotecting the sheet
and changing formulas.

If anyone has a better solution, please advise.

Thanks!





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Disable Tools Protection

See also
http://www.rondebruin.nl/menuid.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"TimN" wrote in message ...
Ron,

Thanks!!! I got rid of the tools protection option. I am going to work
with the code for the password. May have to get back with you on that with
more questions.


"Ron de Bruin" wrote:

Hi Tim

Use this two events in the Thisworkbook module.

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_Activate()
'your code to change Enabled to False
'Or the name of your macro
End Sub

Private Sub Workbook_Deactivate()
'your code to change Enabled to True
'Or the name of your macro
End Sub

If you want to use your macro to protect and unprotect

Then use it like this (ron is the password)

Sub test()
With Sheets("Sheet1")
.Unprotect "ron"
.Range("B1").Value = "Hi"
.Protect "ron"
End With
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl



"TimN" wrote in message ...
Thanks to a post from Ron de Bruin I found the following to disable the Tools
Protection option from the tool bar:

Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=30029, Recursive:=True).Enabled = False

My question is where do I insert this code? Is it in the "This Workbook"
portion of the code? I gave that a try, but nothing happened.

I have protected all the cells where I do not want the user to change a
formula. However, if they try to change a formula they get the Excel message
box that advises them the cell is protected, then tells them how to go
unprotect the worksheet.

At first I password protected the sheet, but then my macro wouldn't run. I
was unsuccessful in writting code to unprotect, run the macro, then protect
the sheet. So, I decided to try just removing the toolsProtection option
from the menu so the user will not have any easy time unprotecting the sheet
and changing formulas.

If anyone has a better solution, please advise.

Thanks!







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
Disable macro selections under tools menu Jeremy Excel Discussion (Misc queries) 1 April 19th 10 08:40 PM
Protection in Tools menu not there. mark antony Excel Worksheet Functions 1 August 14th 08 04:17 AM
Disable Tools Protection Protect Sheet for all users but one Win XP Excel Discussion (Misc queries) 6 January 17th 06 10:46 PM
Disable Option from tools in Menu bar Qaspec Excel Programming 4 December 23rd 04 09:04 PM
Disable Control in Tools Menu Juan Sanchez[_3_] Excel Programming 4 September 30th 04 09:40 PM


All times are GMT +1. The time now is 01:50 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"