Mega Code Archive

 
Categories / VisualBasic Script / Application
 

Removing all toolbars and then restoring them

Sub HideAllToolbars()     Dim toolBar As commandBar     Dim toolBarNum As Integer     Dim toolBarSheet As Worksheet     Set toolBarSheet = Sheets("Sheet1")     Application.ScreenUpdating = False     toolBarSheet.Cells.Clear          toolBarNum = 0     For Each toolBar In CommandBars         If toolBar.Type = msoBarTypeNormal Then             If toolBar.Visible Then                 toolBarNum = toolBarNum + 1                 toolBar.Visible = False                 toolBarSheet.Cells(toolBarNum, 1) = toolBar.name             End If         End If     Next toolBar     Application.ScreenUpdating = True End Sub