Gruppe
Menue
Bereich
Context
Thema
Kontextmenüs und ihre Elemente auflisten
Problem
Wie kann ich alle Kontextmenüs mit ihren Elementen in einem Arbeitsblatt auflisten lassen?
Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.
StandardModule: basMain
Sub ListShortCutMenus()
Dim oBar As CommandBar
Dim iRow As Integer, iCounter As Integer
Application.ScreenUpdating = False
For Each oBar In Application.CommandBars
If oBar.Type = msoBarTypePopup Then
iRow = iRow + 1
Cells(iRow, 1) = oBar.Index
Cells(iRow, 2) = oBar.Name
For iCounter = 1 To oBar.Controls.Count
Cells(iRow, iCounter + 2) = _
oBar.Controls(iCounter).Caption
Next iCounter
End If
Next oBar
Cells.EntireColumn.AutoFit
End Sub