'callback created by [[''creatorRibbonX'']]
'[createRibbonX Application] created by (''patricktoulon'')
'Version 2023 4.9.XX
'POUR MEMO 4 fonctions importantes à connaitre pour les controls dynamiques
'L 'objet IRibbonUI possède 4 méthodes :
'1° myribbon.Invalidate() qui actualise en une seule fois tous les contrôles personnalisés du classeur.
'2° myribbon.InvalidateControl("Id du control") qui actualise un contrôle particulier (ControlID correspond à l'identificateur unique du contrôle).
'3° myRibbon.ActivateTab ("id de l'onglet à activer")qui active l'onglet désigné par son ID dans les parenthèses
'4° myRibbonInvalidateControlMso ("Id de l'element"(onglet/group/control) )qui actualise l'element désigné par son ID dans les parenthèses
'Nom du projet:[C:\Users\patrick1\Desktop\creator demo\Project_Calandrier\exemple.xml]
'créé le:[01/07/2023]
'l'event ribbon onLoad
Public myRibbon As IRibbonUI ' {Variable pour l'object ribbon}
Public an&
Public mois&
Public minItem&
Public maxItem&
'Callback for customUI.onLoad
Sub CustomUIOnLoad(ribbon As IRibbonUI)
Set myRibbon = ribbon
an = Year(Date)
mois = Month(Date)
End Sub
'procedure {onAction}de l'elementgallery [ID:''gallery_1'' ]'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub gallery_1_Click(control As IRibbonControl, id As String, index As Integer)
Dim d As Date, WkD
d = DateSerial(an, mois, 1)
WkD = Weekday(d, vbUseSystemDayOfWeek)
d = d + index - 7 - WkD + 1
ActiveCell = d
End Sub
'procedure {getItemCount} de l'element gallery dynamique[ID:''gallery_1'' ]'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub gallery_1_getItemCount(control As IRibbonControl, ByRef returnedVal)
returnedVal = 49
End Sub
'procedure {getItemLabel} de l'element(gallery)[ID:''gallery_1'' ]'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub gallery_1_getItemLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
Dim dat As Date, lastDay, WkD&
If (an = 0 Or mois = 0) Then: Exit Sub
If index + 1 <= 7 Then
returnedVal = Left(WeekdayName(index + 1), 3)
Else
dat = DateSerial(an, mois, 1)
lastDay = Day(DateSerial(an, mois + 1, 0))
WkD = Weekday(dat, vbUseSystemDayOfWeek)
dat = (dat - WkD) + 1
If index + 1 >= WkD + 7 Then minItem = index + 1 = WkD + 7 - 1
If index + 1 >= WkD + 7 Then
If Month(dat + index - 7) = mois Then
returnedVal = Day(dat + index - 7)
End If
End If
End If
End Sub
'procedure {onChange} de l'element[ID:''comboBox_1'' Label:''Annee'']'dans le parent [comboBox_1'' Label:''Groupe N° 1'']
Sub comboBox_1_onChange(control As IRibbonControl, text As String)
an = Val(text)
myRibbon.InvalidateControl ("gallery_1")
End Sub
'procedure {getItemCount} de l'element comboBox dynamique[ID:''comboBox_1'' Label:''Annee'']'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub comboBox_1_GetItemCount(control As IRibbonControl, ByRef returnedVal)
returnedVal = 10
End Sub
'procedure {getItemLabel} de l'element(gallery)[ID:''comboBox_1'' Label:''Annee'']'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub comboBox_1_GetItemLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = Year(Date) - 5 + index
End Sub
'procedure {onChange} de l'element[ID:''comboBox_2'' Label:''Mois'']'dans le parent [comboBox_2'' Label:''Groupe N° 1'']
Sub comboBox_2_onChange(control As IRibbonControl, text As String)
mois = Month(DateValue("1 / " & text & " / " & an))
myRibbon.InvalidateControl ("gallery_1")
End Sub
'procedure {getItemCount} de l'element comboBox dynamique[ID:''comboBox_2'' Label:''Mois'']'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub comboBox_2_GetItemCount(control As IRibbonControl, ByRef returnedVal)
returnedVal = 12
End Sub
'procedure {getItemLabel} de l'element(gallery)[ID:''comboBox_2'' Label:''Mois'']'dans le parent [group_0'' Label:''Groupe N° 1'']
Sub comboBox_2_GetItemLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = MonthName(index + 1)
End Sub