AW: Hallo Tom
14.12.2004 13:00:56
Tom
Hallo,
da solltest du lieber nicht mit Case arbeiten.
Hier mal ein Beispiel, da kannst du dir mal anschauen ob du nicht lieber auch mit msoControlPopup arbeiten willst. Diese Leiste blendet nicht oft benutzte Button auch aus.
Diese Leiste findest du dann oben neben dem Fragezeichen.
Gruss Tom
Sub MenüEinfügen()
Dim i As Integer
Dim i_Hilfe As Integer
Dim MenüNeu As CommandBarControl
Dim MB As CommandBarControl
Dim MB2 As CommandBarControl
Dim MB3 As CommandBarControl
i = Application.CommandBars(1).Controls.Count
i_Hilfe = Application.CommandBars(1).Controls(i).Index
Set MenüNeu = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Before:=i_Hilfe, Temporary:=True)
MenüNeu.Caption = "| kleine Helfer | "
Set MB = MenüNeu.Controls.Add(Type:=msoControlButton)
With MB
.Caption = "Sverweis einfügen"
.OnAction = "Sverweis"
.Style = msoButtonIconAndCaption
'.FaceId = 195
.BeginGroup = True
End With
Set MB = MenüNeu.Controls.Add(Type:=msoControlButton)
With MB
.Caption = "nur Werte einfügen"
.OnAction = "NurWerteEinfügen"
.Style = msoButtonIconAndCaption
'.FaceId = 364
End With
Set MB = MenüNeu.Controls.Add(Type:=msoControlButton)
With MB
.Caption = "Zellenumbruch setzen"
.Style = msoButtonIconAndCaption
.OnAction = "Zeilenumbruch"
'.FaceId = 3738
End With
Set MB = MenüNeu.Controls.Add(Type:=msoControlPopup, Temporary:=True)
With MB
.Caption = "Rahmen setzen"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlPopup, Temporary:=True)
With MB2
.Caption = "dünner"
End With
Set MB3 = MB2.Controls.Add(Type:=msoControlButton)
With MB3
.Caption = "Aussen"
.Style = msoButtonIconAndCaption
.FaceId = 150
.OnAction = "RahmenAussenDünn"
End With
Set MB3 = MB2.Controls.Add(Type:=msoControlButton)
With MB3
.Caption = "Aussen u. Innen"
.Style = msoButtonIconAndCaption
.FaceId = 203
.OnAction = "RahmenAussenInnenDünn"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlPopup, Temporary:=True)
With MB2
.Caption = "dicker"
End With
Set MB3 = MB2.Controls.Add(Type:=msoControlButton)
With MB3
.Caption = "Aussen"
.Style = msoButtonIconAndCaption
.FaceId = 150
.OnAction = "RahmenAussenDick"
End With
Set MB3 = MB2.Controls.Add(Type:=msoControlButton)
With MB3
.Caption = "Aussen u. Innen"
.Style = msoButtonIconAndCaption
.FaceId = 203
.OnAction = "RahmenAussenInnenDick"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlButton)
With MB2
.Caption = "Keinen"
.Style = msoButtonIconAndCaption
.FaceId = 151
.OnAction = "keinenRahmen"
End With
Set MB = MenüNeu.Controls.Add(Type:=msoControlPopup, Temporary:=True)
With MB
.Caption = "höhe der Zeile / breite der Spalte"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlButton)
With MB2
.Caption = "optimale höhe Zeile u. breite Spalte"
.OnAction = "optiBeide"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlButton)
With MB2
.Caption = "optimale Spaltenbreite"
.Style = msoButtonIconAndCaption
.FaceId = 542
.OnAction = "optiSpalenbreite"
End With
Set MB2 = MB.Controls.Add(Type:=msoControlButton)
With MB2
.Caption = "optimale Zeilenhöhe"
.Style = msoButtonIconAndCaption
.FaceId = 541
.OnAction = "optiZeilenhöhe"
End With
End Sub