Ich habe eine Symbolleiste gebastelt, die sich beim öffnen der Mappe "selbst installiert". Ich würd gerne von Excel Funktionen, wie z.B. "Am Raster ausrichten" mitübernehmen. Kann diese nicht wie gehabt über Anpassen in die Symbolleiste schieben. Bräuchte den Code bzw. die Anweisung für die verschiedenen Funktionen.
Wo findet man eine Übersicht?
Danke
Frank
Hi,
das machst du über die Id.
Beispiel: OptionExplicit
PublicConst strCommandbarName AsString = "Test"
PublicSub prcCreate() Dim MyBar As CommandBar OnErrorResumeNext Application.CommandBars(strCommandbarName).Delete OnErrorGoTo 0 Set MyBar = Application.CommandBars.Add(Name:=strCommandbarName, _ Position:=msoBarFloating, Temporary:=True) MyBar.Controls.Add Type:=msoControlButton, ID:=549 Set MyBar = Nothing EndSub
An die Nummern kommst du so: PublicSub test() Dim oControls As CommandBarControls, oControl As CommandBarControl Dim lID As Long, lRow AsLong lRow = 1 For lID = 0 To 65536 Set oControls = Application.CommandBars.FindControls(ID:=lID) IfNot oControls IsNothingThen For Each oControl In oControls lRow = lRow + 1 Cells(lRow, 1) = lID Cells(lRow, 2) = Replace(oControl.Caption, "&", "") Cells(lRow, 3) = oControl.Parent.Name Cells(lRow, 4) = oControl.Parent.NameLocal Next EndIf Next EndSub