AW: Problem mit Popup-Symbolleiste
24.09.2006 10:34:51
Emil
Hallo Ransi,
hier ist der Code:
Sub CBMausPos()
Set obar = CommandBars("Cell")
With obar
For Each c In .Controls
c.Delete
Next
For i = 1 To 17
Set obtn = obar.Controls.Add
With obtn
If i = 5 Or i = 6 Or i = 8 Or i = 11 Or i = 13 Then .BeginGroup = True
.Style = msoButtonIconAndCaption
.Height = 20
.Width = 1
End With
Next
End With
obar.Controls(8).Caption = "Neue Zeilen einfügen
obar.Controls(8).OnAction = "CBZeilenNeu"
End Sub
Sub CBZeilenNeu()
On Error Resume Next
Application.CommandBars("leiste2").Delete
Set obar = Application.CommandBars.Add("leiste2", msoBarPopup, False, True)
For i = 1 To 6
Set obtn = obar.Controls.Add
With obtn
.Style = msoButtonIconAndCaption
.Height = 20
.Width = 200
End With
Next
obar.Controls(1).Caption = "1 Zeile einfügen"
obar.Controls(2).Caption = "2 Zeilen einfügen"
obar.Controls(3).Caption = "3 Zeilen einfügen"
obar.Controls(4).Caption = "5 Zeilen einfügen"
obar.Controls(5).Caption = "10 Zeilen einfügen"
obar.Controls(6).Caption = "20 Zeilen einfügen"
obar.Controls(1).Tag = 1
obar.Controls(2).Tag = 2
obar.Controls(3).Tag = 3
obar.Controls(4).Tag = 5
obar.Controls(5).Tag = 10
obar.Controls(6).Tag = 20
For i = 1 To 6
obar.Controls(i).OnAction = "ZeilenEinfuegen"
Next
obar.Width = 1
obar.ShowPopup
End Sub
Gruß Emil