Hi oleneazer,
I am not sure if this post is in the right forum. Did you want to make this function a kb entry or is this your Excel question ?
Both way, following modification in your code might help.
Sub Testbar()
Dim objMainPopUp As CommandBarPopup
Dim objPopUp As CommandBarPopup
Dim objButton As CommandBarButton
Dim iMois, iJour As Integer
Dim cb As CommandBar
Dim graphBtn As CommandBarButton
Set cb = CommandBars.Add(Name:="test", Position:=msoBarTop)
cb.Visible = True
Set objMainPopUp = cb.Controls.Add(msoControlPopup)
objMainPopUp.Caption = "Total"
Set objPopUp = objMainPopUp.Controls.Add(msoControlPopup)
objPopUp.Caption = "Total-Jour de: " & UCase(Format(DateSerial(1, Month(Date), 1), "mmmm"))
For iJour = 1 To Day(DateSerial(Year(Date), Month(Date) + 1, 0))
Set objButton = objPopUp.Controls.Add
With objButton
.Caption = Format(DateSerial(Year(Date), Month(Date), iJour), "dddd dd")
.OnAction = "macro1"
.Style = msoButtonCaption
End With
Next iJour
Set objPopUp = objMainPopUp.Controls.Add(msoControlPopup)
objPopUp.Caption = "TOTAL Mensuel"
For iMois = 1 To 12
Set objButton = objPopUp.Controls.Add
With objButton
.Caption = Application.WorksheetFunction.Proper(Format(DateSerial(1, iMois, 1), "mmmm"))
.OnAction = "Macro2"
.Style = msoButtonCaption
.BeginGroup = True
End With
Next iMois
End Sub
I hope it helps.
Suat