Hide toolbars

abz2max

New Member
Joined
Apr 16, 2002
Messages
19
Will this line hide all the toolbars, if not can u give me 1 that will.

Toolbars("Standard").Visible = False
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Well if it does you may want to consider something in Workbook_BeforeClose =True
 
Upvote 0
i will do that, but first i need a formula that will hide all the toolbars. The formula i gave doesnt do that.
 
Upvote 0
Sub HideAllToolBars()
Dim TB As CommandBar
Dim TBNum As Integer
Dim TBSheet As Worksheet
Set TBSheet = Sheets("TBSheet")
Application.ScreenUpdating = False

'Clear the sheet
TBSheet.Cells.Clear

'Hide all visible toolbars and restore
'their names
TBNum = 0
For Each TB In CommandBars
If TB.Type = msoBarTypeNormal Then
If TB.Visible Then
TBNum = TBNum + 1
TB.Visible = False
TBSheet.Cells(TBNum, 1) = TB.Name
End If
End If
Next TB
Application.ScreenUpdating = True
End Sub

Sub RestoreToolBars()
Dim TBSheet As Worksheet
Set TBSheet = Sheets("TBSheet")
Application.ScreenUpdating = False

'Unhide the previously displayed the toolbars
On Error Resume Next
For Each Cell In TBSheet.Range("A:A") _
.SpecialCells(xlCellTypeConstants)
CommandBars(cell.Value).Visible = True
Next cell
Application.ScreenUpdating = True
End Sub

P.S.
The HideAllToolBars procedure is called from
the Workbook_Open event handler and the
RestoreToolBars procedure is called from the
Workbook_BeforeClose event handler

James

_________________
This message was edited by James on 2002-05-04 18:01
 
Upvote 0
It hides your Tool Bars when the Workbook is opened and retores them when the Workbook is closed.

I may be wrong, but isn't that what you wanted to do? Your post said "HideAllToolBars"

James

_________________
This message was edited by James on 2002-05-04 20:17
 
Upvote 0
Had the same problem myself, try this

Put this into the workbook Code
You can play around with the alternatives

Private Sub Workbook_Activate()
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Worksheet Menu Bar").Enabled = False
With ActiveWindow
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
End With

End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Worksheet Menu Bar").Enabled = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,052
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top