Microsoft Office Tutorials and References
In Depth Information
Hiding All Standard Toolbars Except Your Own
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Const BarName As String = "My Bar"¶
Const ControlTag As String = "HideControl"¶
' * * * * *¶
Sub ShowHideToolbars()¶
'Variable declaration¶
Dim i As Long¶
Dim Show As Boolean¶
Dim Bar As CommandBar¶
'Exit on error¶
On Error GoTo err_h¶
With Application.CommandBars.FindControl(Tag:=ControlTag)¶
If .State = msoButtonUp Then¶
'Hide them¶
Show = False¶
'Change the state of the button¶
.State = msoButtonDown¶
.Caption = "&X Show"¶
'Show them¶
Show = True¶
'Change the state of the button¶
.State = msoButtonUp¶
.Caption = "&X Hide"¶
End If¶
End With¶
'Sheet to store the information, can be hidden¶
With ActiveSheet¶
If Show Then¶
'Loop through the entries that were saved, displaying them¶
For i = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row¶
Application.CommandBars(.Cells(i, _¶
1).Value).Visible = True¶
Next i¶
'Enable the Worksheet and Chart menu bar¶
Application.CommandBars(1).Enabled = True¶
Application.CommandBars(2).Enabled = True¶
'Delete the entries¶
'Display the formula bar?¶
Application.DisplayFormulaBar = True¶
i = 0¶
Search JabSto ::

Custom Search