Habe folgendes Problem.
Ich möchte diesen Code um ein Menue "Jahre" erweitern.
Bekomme es aber nicht hin.
Kann mir jemand helfen oder einen Tipp geben.
Private Sub Workbook_Open()
Dim oBar As CommandBar
Dim oCntr As CommandBarControl
Dim oBtn As CommandBarButton
Dim iMonth As Integer, iDay As Integer
Call CmdDelete
Set oBar = Application.CommandBars.Add("Datum", msoBarPopup)
Set oBtn = oBar.Controls.Add
With oBtn
.Caption = Year(Date)
.Style = msoButtonCaption
End With
For iMonth = 1 To 12
Set oCntr = oBar.Controls.Add(msoControlPopup)
oCntr.Caption = Format(DateSerial(Year(Date), iMonth, 1), "mmmm")
If iMonth = 1 Then oCntr.BeginGroup = True
For iDay = 1 To Day(DateSerial(Year(Date), iMonth + 1, 0))
Set oBtn = oCntr.Controls.Add
With oBtn
.Caption = iDay
.Style = msoButtonCaption
.OnAction = "Kalender"
End With
Next iDay
Next iMonth
End Sub
Für jeden Ansatz schon mal Danke
Gruss Erich