Gruppe
Menue
Problem
Wie kann ich beim Laden einer Arbeitsmappe alle Symbolleisten ausund eine benutzerdefinierte Leiste einblenden? Nach dem Schließen der Arbeitsmappe soll der alte Zustand wieder hergestellt werden.
ClassModule: DieseArbeitsmappe
Private Sub Workbook_Open()
Dim oBar As CommandBar
Dim wks As Worksheet
Dim iRow As Integer
Set wks = ThisWorkbook.Worksheets("CmdBars")
wks.Cells.ClearContents
For Each oBar In Application.CommandBars
If oBar.Visible And oBar.Type <> msoBarTypeMenuBar Then
iRow = iRow + 1
wks.Cells(iRow, 1).Value = oBar.Name
oBar.Visible = False
End If
Next oBar
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim oBar As CommandBar
Dim iRow As Integer
iRow = 1
With ThisWorkbook.Worksheets("CmdBars")
Do Until IsEmpty(.Cells(iRow, 1))
Application.CommandBars(.Cells(iRow, 1).Value).Visible = True
iRow = iRow + 1
Loop
.Cells.ClearContents
End With
End Sub
Sub AusEinblenden()
ThisWorkbook.Worksheets("CmdBars").Visible = xlVeryHidden
'ThisWorkbook.Worksheets("CmdBars").Visible =true
End Sub