Microsoft Office Tutorials and References
In Depth Information
Hiding All Standard Toolbars Except Your Own
'Loop through the Toolbars and save the ones that are visible¶
For Each Bar In Application.CommandBars¶
If Bar.Type = msoBarTypeNormal Then¶
If Not Bar.Name = BarName Then¶
If Bar.Visible Then¶
'Save the entry in the worksheet¶
i = i + 1¶
.Cells(i, 1).Value = Bar.Name¶
Bar.Visible = False¶
End If¶
End If¶
End If¶
Next Bar¶
'Disable the Worksheet and Chart menu bar¶
Application.CommandBars(1).Enabled = False¶
Application.CommandBars(2).Enabled = False¶
'Hide the formula bar?¶
Application.DisplayFormulaBar = False¶
End If¶
End With¶
Exit Sub¶
err_h:¶
End Sub¶
' * * * * *¶
Sub CreateBar()¶
'Custom toolbar here¶
'Variable declaration¶
Dim Bar As CommandBar¶
Dim Ctl As CommandBarButton¶
'Delete any previous bars¶
DeleteBar¶
Set Bar = Application.CommandBars.Add(Name:=BarName, _¶
Position:=msoBarTop)¶
With Bar¶
'Add only one button¶
With .Controls.Add(Type:=msoControlButton)¶
.Caption = "&X Hide"¶
.FaceId = 35¶
.Style = msoButtonIconAndCaption¶
'Set default to "not pressed"¶
.State = msoButtonUp¶
.OnAction = "ShowHideToolbars"¶
.Tag = ControlTag¶
End With¶
.Visible = True¶
End With¶
End Sub¶
Exl
Search JabSto ::




Custom Search