ich habe aus dem Archiv ein Makro gefunden zum Erstellen einer eigenen Symboilleiste und für mich angepasst. Funzt super.
Was muss ich aber machen, wenn ich Untermenüs aufklappen möchte?
Option Explicit
Private Sub Workbook_Open()
Application.Caption = "eigene Symbolleiste"
Dim cb As CommandBar
Dim CBC As CommandBarButton
Dim i%
On Error Resume Next
Set cb = Application.CommandBars.Add(Name:="Leiste", _
temporary:=True, Position:=msoBarTop)
On Error GoTo 0
If Application.CommandBars("Leiste").Visible = False Then
cb.Visible = True
For i = 1 To 3
Set CBC = cb.Controls.Add(Type:=msoControlButton)
With CBC
.Width = 50 ' Breite der Schalter
.Style = msoButtonIconAndCaption ' Text und Icon
Select Case i
Case 1
.FaceId = 576 ' Icon vor Beschriftung
.Caption = "Eintragen"
.OnAction = "Makro1"
.TooltipText = "Tooltip noch überlegen"
Case 2
.FaceId = 59 ' Icon vor Beschriftung
.Caption = "Einfügen"
.OnAction = "Makro2"
.TooltipText = "Tooltip noch überlegen"
Case 3
.FaceId = 47
.Caption = "Löschen"
.OnAction = "Makro3"
.TooltipText = "Tooltip noch überlegen"
End Select
End With
Next i
End If
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
End Sub
Private Sub Workbook_Activate()
On Error GoTo neu
If Application.CommandBars("Leiste").Visible = False Then
Application.CommandBars("Leiste").Visible = True
End If
Exit Sub
neu:
Workbook_Open
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Leiste").Delete
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
On Error GoTo neu
If Application.CommandBars("Leiste").Visible = False Then
Application.CommandBars("Leiste").Visible = True
End If
Exit Sub
neu:
Workbook_Open
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.Caption = ""
End Sub
Wer kann mir bitte mit einem Beispiel helfen das sich mind. zwei Untermenüs öffnen und erst dann ein hinterlegtes Makro läuft.
Ich hoffe ich bin nicht unverschämt, habe aber im Archiv nix passendes gefunden.
Vielen Dank vorab für Eure Hilfe
Gruß
Claudia