AW: Befehlsschaltfläche für Makro automatisch einf
02.12.2005 14:37:37
Horst
Hallo Daniel,
leider kann ich dir erst jetzt antworten, da ich bis jetzt nicht an meinem Arbeitsplatz war.
Ich habe inzwischen beim Stöbern im Internet ein Makro gefunden, das alle möglichen Symbole mit der zugehörigen FaceID als Listen in eine neue Symbolleiste einfügt, so dass man sich die einzeln ansehen kann.
Wenn's dich interessiert:
Const cBarName As String = "FaceIds-CommandBarButtons"
Sub SymbolleisteErstellen()
Dim cBar As CommandBar
Dim cBarButton As CommandBarButton
Dim cBarPopUp As CommandBarPopup
Dim IdNummer As Integer
Dim j As Integer
Dim i As Integer
'Prüfen, ob Symbolleiste schon vorhanden ist:
For Each cBar In Application.CommandBars
If cBar.Name = cBarName Then GoTo ende
Next
'Wenn Symbolleiste nicht vorhanden ist, Symbolleiste erstellen:
' (Temporary = True - Die Symbolleiste wird automatisch gelöscht,
' wenn die Excel-Anwendung geschlossen wird.)
Set cBar = CommandBars.Add _
(Name:=cBarName, Position:=msoBarTop, Temporary:=True)
cBar.Visible = True
IdNummer = -249
'Anzahl Face-IDs gesamt: 3518
'Erstellt werden 15 Dropdown-Menüs mit je 250 Buttons:
For j = 1 To 15
'PopUp-Menü zur Symbolleiste hinzufügen:
Set cBarPopUp = cBar.Controls.Add(Type:=msoControlPopup)
IdNummer = IdNummer + 250
With cBarPopUp 'Eigenschaften des Menüpunkts setzen
.Caption = "ID : " & IdNummer & " - " & IdNummer + 249
End With
For i = IdNummer To IdNummer + 249
'Ein ControlButton hinzufügen:
Set cBarButton = cBarPopUp.Controls.Add _
(Type:=msoControlButton, Id:=2950)
'Eigenschaften des ControlButton setzen
With cBarButton
.Style = msoButtonIconAndCaption
.Caption = "ID : " & i
.FaceId = i
End With
Next i
Next j
Set cBarPopUp = Nothing
Set cBarButton = Nothing
Set cBar = Nothing
Exit Sub
ende:
MsgBox "Die Symbolleiste '" & cBarName & "' existiert bereits.", _
vbOKOnly + vbInformation, Title:=cBarName
CommandBars(cBarName).Visible = True
End Sub
Horst