Re: temporäre Symbolleiste
26.11.2002 17:22:37
Olaf
Hallo Herbert,wie wärs damit, mußt es nur an deine aufgabe anpassen
Private Sub Workbook_Open()
Dim NCB As CommandBar
Dim Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11, Button12 As CommandBarButton
'oder
'Dim Button (1 to 12) As CommandBarButton
Set NCB = Application.CommandBars.Add(Name:="Monate", Position:=msoBarBottom, Temporary:=True)
With NCB
.Visible = True
.Left = 200
End With
Set Button1 = NCB.Controls.Add(Type:=msoControlButton)
With Button1
.Width = 30
.Caption = "Drucker"
.FaceId = 2521
.OnAction = "Drucken"
End With
Set Button2 = NCB.Controls.Add(Type:=msoControlButton)
With Button2
.Width = 25
.Style = msoButtonCaption
.Caption = "Januar"
.OnAction = "modul1.januar"
End With
Set Button3 = NCB.Controls.Add(Type:=msoControlButton)
With Button3
.Width = 25
.Style = msoButtonCaption
.Caption = "Februar"
.OnAction = "modul1.februar"
End With
Set Button4 = NCB.Controls.Add(Type:=msoControlButton)
With Button4
.Width = 25
.Style = msoButtonCaption
.Caption = "März"
.OnAction = "modul1.märz"
End With
Set Button5 = NCB.Controls.Add(Type:=msoControlButton)
With Button5
.Width = 25
.Style = msoButtonCaption
.Caption = "April"
.OnAction = "modul1.april"
End With
Set Button6 = NCB.Controls.Add(Type:=msoControlButton)
With Button6
.Width = 25
.Style = msoButtonCaption
.Caption = "Mai"
.OnAction = "modul1.mai"
End With
Set Button7 = NCB.Controls.Add(Type:=msoControlButton)
With Button7
.Width = 25
.Style = msoButtonCaption
.Caption = "Juni"
.OnAction = "modul1.juni"
End With
Set Button8 = NCB.Controls.Add(Type:=msoControlButton)
With Button8
.Width = 25
.Style = msoButtonCaption
.Caption = "Juli"
.OnAction = "modul1.juli"
End With
Set Button9 = NCB.Controls.Add(Type:=msoControlButton)
With Button9
.Width = 25
.Style = msoButtonCaption
.Caption = "August"
.OnAction = "modul1.August"
End With
Set Button10 = NCB.Controls.Add(Type:=msoControlButton)
With Button10
.Width = 25
.Style = msoButtonCaption
.Caption = "September"
.OnAction = "modul1.september"
End With
Set Button11 = NCB.Controls.Add(Type:=msoControlButton)
With Button11
.Width = 25
.Style = msoButtonCaption
.Caption = "Oktober"
.OnAction = "modul1.oktober"
End With
Set Button12 = NCB.Controls.Add(Type:=msoControlButton)
With Button12
.Width = 25
.Style = msoButtonCaption
.Caption = "November"
.OnAction = "modul1.november"
End With
Set Button13 = NCB.Controls.Add(Type:=msoControlButton)
With Button13
.Width = 25
.Style = msoButtonCaption
.Caption = "Dezember"
.OnAction = "modul1.dezember"
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim NBC As CommandBar
For Each CB In Application.CommandBars
If CB.Name = "Monate" Then
CB.Delete
End If
Next
End Sub