Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
'ThisWorkbook code!
'Add your Workbook's name here, the one that gets Grayed-out!
If Wb.Name <> "GrayOutToolsCommandBars" Then
'Un-Hide the Print Menu Item!
'File menu, count each item including mouse-over additional items!
Application.CommandBars("File").Controls(15).Enabled = True
'Toolbars: View - Toolbars - Standard
'The actual count from left to right on your tool bar, not a default Index!
Application.CommandBars("Standard").Controls(9).Enabled = True
Else
'Gray-out Hide the Print Menu Item!
'File menu, count each item including mouse-over additional items!
Application.CommandBars("File").Controls(15).Enabled = False
'Toolbars: View - Toolbars - Standard
'The actual count from left to right on your tool bar, not a default Index!
Application.CommandBars("Standard").Controls(9).Enabled = False
End Sub
Sub myHidePrint()
'Standard module code, like: Module1.
'Gray-out Hide the Print Menu Item!
'File menu, count each item including mouse-over additional items!
Application.CommandBars("File").Controls(15).Enabled = False
'Toolbars: View - Toolbars - Standard
'The actual count from left to right on your tool bar, not a default Index!
Application.CommandBars("Standard").Controls(9).Enabled = False
End Sub
Sub myShowPrint()
'Standard module code, like: Module1.
'Un-Hide the Print Menu Item!
'File menu, count each item including mouse-over additional items!
Application.CommandBars("File").Controls(15).Enabled = True
'Toolbars: View - Toolbars - Standard
'The actual count from left to right on your tool bar, not a default Index!
Application.CommandBars("Standard").Controls(9).Enabled = True
End Sub
Sub myHideMB()
'Standard module code, like: Module1.
'Gray-out Hide the Protection Menu Item!
CommandBars("Worksheet Menu Bar").Controls( _
"Tools").Controls("Protection").Enabled = False
End Sub
Sub myShowMB()
'Standard module code, like: Module1.
'Un-Hide the Protection Menu Item!
CommandBars("Worksheet Menu Bar").Controls( _
"Tools").Controls("Protection").Enabled = True
End Sub
Sub myProTest()
'Standard module code, like: Module1.
'Test for protection!
If ActiveSheet.ProtectContents = True Then
MsgBox "Protected!"
Else
MsgBox "Not protected!"
End If
End Sub
Sub myDePro()
'Standard module code, like: Module1.
'Work with the Protection Toolbar!
For Each Bar In Application.CommandBars
If Bar.Name = "Protection" Then
Bar.Protection = msoBarNoProtection
Bar.Enabled = True
Bar.Visible = True
Bar.Position = msoBarSide
MsgBox "Will now Hide the Protection Toolbar!"
Bar.Enabled = False
Bar.Visible = False
End If
Next Bar
End Sub
Sub myBar()
'Standard module code, like: Module1.
'List all toolbars!
For Each Bar In Application.CommandBars
myLst = myLst & Bar.Name & ", "
Next Bar
MsgBox myLst
End Sub