Gruppe
Menue
Problem
Wie kann ich der Standardsymbolleiste beim Laden dieser Arbeitsmappe ein Schaltflächensymbol hinzufügen und beim Schließen der Arbeitsmappe wieder entfernen?
ClassModule: DieseArbeitsmappe
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Standard") _
.Controls("MyButton").Delete
On Error GoTo 0
End Sub
Private Sub Workbook_Open()
Dim oBar As CommandBar
Dim oBtn As CommandBarButton
Set oBar = Application.CommandBars("Standard")
On Error Resume Next
oBar.Controls("MyButton").Delete
On Error GoTo 0
Set oBtn = oBar.Controls.Add
With oBtn
.Caption = "MyButton"
.Style = msoButtonIcon
.FaceId = 361
.OnAction = "Meldung"
End With
End Sub
StandardModule: Modul1
Sub Meldung()
MsgBox prompt:="Hallo!"
End Sub