Hi,sorry but it doesn't work.I get an error 5On 2002-08-27 10:29, KniteMare wrote:
Yes you can
But do not forget to turn it back on. See all the examples here.
Private Sub Workbook_Activate()
Application.CommandBars("Tools").Controls("Protection").Enabled = False
End Sub
Private Sub Workbook_Deactivate()
Application.CommandBars("Tools").Controls("Protection").Enabled = True
End Sub
Private Sub Workbook_Open()
Application.CommandBars("Tools").Controls("Protection").Enabled = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Tools").Controls("Protection").Enabled = True
End Sub
Yours in EXCELent Frustration
KniteMare
_________________
Of course I can, and it will take only 900 hours of programming time to do it.
This message was edited by KniteMare on 2002-08-27 10:29
Hi,On 2002-08-27 14:11, kskinne wrote:
Is there a way to do this so that instead of just graying out the menu or menu item (as this code does), the menu or menu item is completely removed from the menu bar?
thanks,
kevin
Sorry Kevin,but the same error.On 2002-08-27 14:57, kskinne wrote:
instead of this code:
Application.CommandBars("Tools").Controls("Protection").Enabled = False
use this code:
Application.CommandBars("Tools").Controls("Protection").Visible = False
where 'enabled' is replaced by 'visible'
HTH
kevin
Private Sub Workbook_Open()
Application.CommandBars(1).FindControl(Id:=30029, recursive:=True).Visible = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).FindControl(Id:=30029, recursive:=True).Visible = True
End Sub