Gruppe
Menue
Bereich
Bar
Thema
Prüfung, ob eine Symbolleiste existiert
Problem
Wie kann ich beim Öffnen einer Arbeitsmappe über VBA prüfen, ob eine bestimmte Symbolleiste existiert?
Lösung
Geben Sie den Ereigniscode in das Klassenmodul der Arbeitsmappe ein.
ClassModule: DieseArbeitsmappe
Private Sub Workbook_Open()
Dim oBas As CommandBar
On Error GoTo ERRORHANDLER
Set oBas = _
Application.CommandBars("MeineSymbolleiste")
MsgBox "Die Symbolleiste" & _
"""MeineSymbolleiste"" existiert!"
Exit Sub
ERRORHANDLER:
MsgBox "Die Symbolleiste" & _
"""MeineSymbolleiste"" existiert nicht!"
End Sub