Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commandbars 1

Status
Not open for further replies.

isma786

Technical User
Apr 7, 2004
31
0
0
US
Hi

I want to rid of all the visible commandbars per spreadsheet upon opening then making then same commandbars that were made invisible to be visible again upon exiting.

is this possible?

 
is,

Run CollectToolbarStatus from the Workbook_Open event.

Run ResetToolbarStatus from the Workbook_Close event.
Code:
Sub CollectToolbarStatus()
   Set ws1 = Worksheets.Add
   With ws1
      r = 1
      For Each tb In Application.Toolbars
         .Cells(r, 1).Value = tb.Name
         .Cells(r, 2).Value = tb.Visible
         r = r + 1
      Next
      .Name = "tb"
      .Visible = xlSheetVeryHidden
   End With
End Sub
Sub ResetToolbarStatus()
   Application.DisplayAlerts = False
   With Sheets("tb")
      For Each t In .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
         With t
            Application.Toolbars(.Value).Visible = .Offset(0, 1).Value
         End With
      Next
      .Visible = xlSheetVisible
      .Delete
   End With
   Application.DisplayAlerts = True
End Sub
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top