MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Protecting Worksheet/Workbook


Posted by Paul on December 13, 2000 2:19 PM

How do you protect a W/sheet W/book from being unprotected by a password cracking program. It runs as an ADD IN and when finished your workbook is unprotected for anybodies use!

Is there code to stop excel running ADD IN???

Please help.


Posted by Kurt Cobain on December 14, 2000 8:03 AM

Yes there is. You have to make your the tools
function disactive coz the add in will load
under the tools option. You should thank Ivan Maola
for this code. He deserve the credit.

Paste this under your workbook module :

Sub Disable_Tools()
Application.CommandBars("Worksheet Menu Bar").Controls("tools").Enabled =False
End sub


Sub Enable_Tools()
Application.CommandBars("Worksheet Menu Bar").Controls("tools").Enabled =True
End sub


While this code paste under your module :


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Enable_Tools
End Sub

Private Sub Workbook_Open()
Disable_Tools
End Sub


Hope this helps .regards


Posted by Paul on December 14, 2000 3:37 PM

Many thanks for your help

Thank you!

Posted by Kurt Cobain on December 14, 2000 3:53 PM

Re: Many thanks for your help

no problem buddy