Menü und Symbolleisten ( bis Excel 2003 )
Befehl / Beispiele Beschreibung
Application.CommandBars(1).Enabled= True / False Menüleiste ein / ausblenden  ( bis Excel 2003 )
Beispiel:
Sub MenüleisteEinAusblenden()
'+--------------------------------------------------------------+
'|  Ein / aus-blenden der Menüleiste                            |
'|  Gültig bis Excel 2003                                       |
'|  Achtung läßt sich nur in VBA nicht unter Excel schalten !!  |
'+--------------------------------------------------------------+
    Application.CommandBars(1).Enabled = Not Application.CommandBars(1).Enabled
End Sub
Application.CommandBars(<Nr>).Enabled = True / False
Application.CommandBars(<Nr>).Visible = True / False
Symbolleiste aktivieren / deaktivieren ( bis Excel 2003 )
Symbolleiste ein- / ausblenden ( bis Excel 2003 )
Beispiel l:
Sub AlleSymbolleistenEinblenden()
'+--------------------------------------------------------+
'|  Alle Sybolleisten aktivieren, einblenden sowie deren  |
'|  Index-Nr, englische und deutsche Namen auflisten.     |
'|  ACHTUNG: Es wird ein neues Tabellenblatt erstellt     |
'|  Gültig bis EXCEL 2003                                 |
'+--------------------------------------------------------+
   Dim AzSymolLeiste As Integer
   Dim Nr As Integer

   Dim SymbolLeiste As CommandBars:   Set SymbolLeiste = Application.CommandBars

   AzSymbolLeisten = SymbolLeiste.Count
   Sheets.Add Sheets(1)
   On Error Resume Next
   Cells(1, 1) = "Nummer"
   Cells(1, 2) = "Englischer Name"
   Cells(1, 3) = "Deutscher Name"
   For Nr = 1 To AzSymbolLeisten
       SymbolLeiste(Nr).Enabled = True
       SymbolLeiste(Nr).Visible = True
       Cells(Nr + 1, 1) = Nr
       Cells(Nr + 1, 2) = SymbolLeiste(Nr).Name
       Cells(Nr + 1, 3) = SymbolLeiste(Nr).NameLocal
   Next Nr
End Sub


Beispiel 2:
Sub NurStandardSymbolleistenEinblenden()
'+-----------------------------------------------------------+
'|  Alle Sybolleisten aktivieren und nur die Symbolleisten:  |
'|  STANDARD, FORMAT und ZEICHNEN einblenden                 |
'|  Gültig bis EXCEL 2003                                    |
'+-----------------------------------------------------------+
   Dim AzSymolLeiste As Integer
   Dim Nr As Integer

   Dim SymbolLeiste As CommandBars:   Set SymbolLeiste = Application.CommandBars

   AzSymbolLeisten = SymbolLeiste.Count

   On Error Resume Next
   For Nr = 1 To AzSymbolLeisten
       SymbolLeiste(Nr).Enabled = True
       If Nr = 3 Or Nr = 4 Or Nr = 26 Then
          SymbolLeiste(Nr).Visible = True
       Else
          SymbolLeiste(Nr).Visible = False
       End If
   Next Nr
   Cells.EntireColumn.AutoFit
End Sub


Beispiel 3:
Sub AlleSymbolleistenAusblenden()
'+-----------------------------------------------+
'|  Alle Sybolleisten aktivieren und ausblenden  |
'|  Gültig bis EXCEL 2003                        |
'+-----------------------------------------------+
    Dim AzSymolLeiste As Integer
    Dim Nr As Integer

    Dim SymbolLeiste As CommandBars: Set SymbolLeiste = Application.CommandBars

    AzSymbolLeisten = SymbolLeiste.Count

    On Error Resume Next
    For Nr = 1 To AzSymbolLeisten
        SymbolLeiste(Nr).Enabled = False
        SymbolLeiste(Nr).Visible = False
    Next Nr
End Sub
Application.CommandBars.Add(Name:=<Name>).Visible = True Symbolleiste erstellen
Beispiel:
Sub SymbolleisteHinzu(Name)
'+--------------------------+
'|  Symbolleiste erstellen  |
'+--------------------------+
    On Error Resume Next
       Application.CommandBars(Name).Delete        ' Falls die Symbolleiste bereits existiert
    On Error GoTo 0
    Application.CommandBars.Add(Name:=Name).Visible = True
End Sub
Application.CommandBars(LeistenName).Controls.Add 1, SymbolIndex, , 1 Symbol in Symbolleiste einfügen
Beispiel:
Sub LeisteMitSymbolAnlegen()
'+-------------------------------------------------------------------+
'|  Es wird eine neue Symbolleiste angelegt mit einem Smiley-Symbol  |
'|  Diesem Symbol wird die Prozedur "TestProz" zugeordnet.           |
'+-------------------------------------------------------------------+
    SymbolleisteHinzu "Test"
    SymbolHinzu "Test", 2950, "Kleine Testprozedur", "TestProz"
End Sub

Sub SymbolleisteHinzu(Name)
'+--------------------------+
'|  Symbolleiste erstellen  |
'+--------------------------+
    On Error Resume Next
       Application.CommandBars(Name).Delete
    On Error GoTo 0
    Application.CommandBars.Add(Name:=Name).Visible = True
End Sub

Sub SymbolHinzu(LeistenName, SymbolIndex, Bemerkung, Makroname)
'+------------------------------------------+
'|  Symbol in eine Symbolleiste hinzufügen  |
'+------------------------------------------+
    On Error Resume Next
       Application.CommandBars(LeistenName).Controls.Add 1, SymbolIndex, , 1
       Application.CommandBars(LeistenName).Controls.Item(1).Name = Bemerkung
       Application.CommandBars(LeistenName).Controls.Item(1).OnAction = Makroname
    On Error GoTo 0
End Sub

Sub TestProz()
    MsgBox "Test"
End Sub
Symbolleisten-Symbole listen
Beispiel:
Sub SymbolleistenSymboleListen()
'+---------------------------------------------------------------+
'|  Symbole der Symbolleisten über mehrere Symbolleisten listen  |
'+---------------------------------------------------------------+
    AlleLeistenLöschen
    SymboleListen 1, 1000, 50
End Sub

Sub AlleLeistenLöschen()
'+------------------------------+
'|  Alle Symbolleisten löschen  |
'+------------------------------+
    Dim Nr As Integer

    On Error Resume Next
    For Nr = Application.CommandBars.Count To 1 Step -1
        Application.CommandBars(Nr).Delete
    Next Nr
End Sub

Sub SymboleListen(Von, Bis, Gruppe)
'+------------------------------------------------+
'|  Mehrere Symbol nach ihrem Symbolindex listen  |
'+------------------------------------------------+
'|  Von / Bis = Symbol-Index                      |
'|  Gruppe = Anzahl der Symbolleisten             |
'+------------------------------------------------+
    Dim Anfang As Integer
    Dim Nr As Integer
    Dim SymbolLeiste As Integer
    Dim SymbolLeistenName As String
    Dim SymbolIndex As Integer

    SymbolIndex = Von - 1
    Do
      SymbolLeiste = SymbolLeiste + 1
      SymbolLeistenName = "SymLeiste" & "_" & SymbolLeiste
      SymbolleisteHinzu SymbolLeistenName                               ' Symbolleiste erstellen
      For Nr = 1 To Gruppe
          SymbolIndex = SymbolIndex + 1
          If SymbolIndex > Bis Then Exit Do
          SymbolHinzu SymbolLeistenName, SymbolIndex, SymbolIndex, ""   ' Symbol erstellen
      Next Nr
    Loop
End Sub

Sub SymbolleisteHinzu(Name)
'+--------------------------+
'|  Symbolleiste erstellen  |
'+--------------------------+
    On Error Resume Next
       Application.CommandBars(Name).Delete               ' Löschen der Symbolleiste,
                                                          ' falls bereits vorhanden
    On Error GoTo 0
    Application.CommandBars.Add(Name:=Name).Visible = True ' Symbolleiste erstellen
End Sub

Sub SymbolHinzu(LeistenName, SymbolIndex, Bemerkung, Makroname)
'+------------------------------------------+
'|  Symbol in eine Symbolleiste hinzufügen  |
'+------------------------------------------+
    On Error Resume Next
       Application.CommandBars(LeistenName).Controls.Add 1, SymbolIndex, , 1          ' Symbol hinzufügen
       Application.CommandBars(LeistenName).Controls.Item(1).Caption = SymbolIndex    ' Quickinfo-Anzeige
       Application.CommandBars(LeistenName).Controls.Item(1).OnAction = Makroname     ' Makrozuweisung
    On Error GoTo 0
End Sub