'mise ajour du clavier
Public Sub ReloadClavier()
Dim X&, I&, A&, NB_JOURS&, Y&, WkD&
If Cbmonth.Value = "" Or Cbyear.Value = "" Then Exit Sub
Select Case Calendar.region
Case 0, 22: WkD = vbSunday
Case 1, 2, 12, 13: WkD = vbMonday
End Select
X = Weekday(DateSerial(Calendar.Cbyear, Calendar.Cbmonth.ListIndex + 1, 1), WkD)
NB_JOURS = Day(DateSerial(Cbyear.Value, Cbmonth.ListIndex + 2, 0))
For I = 1 To 6: Me.Controls("sem" & I) = "": Next
For I = 1 To 42
With Calendar.Controls("j" & I)
.Caption = "": .Enabled = False: .BackColor = bt2Back: .ControlTipText = ""
If I >= X And A <= NB_JOURS - 1 Then
.Visible = True: A = A + 1: .Enabled = True: .Caption = A: .BackColor = bt1Back
Y = CLng(DateSerial(Calendar.Cbyear.Value, Calendar.Cbmonth.ListIndex + 1, A))
Controls(.Tag).Caption = Evaluate("= TRUNC((" & Y & "-WEEKDAY(" & Y & ",2)+11-DATE(YEAR(" & Y & "-WEEKDAY(" & Y & " ,2)+4),1,1))/7)")
.BackColor = férié(I)
End If
Dim j
For j = 2 To 6
If Calendar.Controls("j" & I).Enabled = True Then If Calendar.Controls("sem" & j).Caption = Calendar.Controls("sem" & j - 1).Caption Then Calendar.Controls("sem" & j).Caption = Val(Calendar.Controls("sem" & j).Caption) + 1
Next
End With
Next
End Sub
'mise ajour du clavier
Public Sub ReloadClavier()
Dim X&, I&, A&, NB_JOURS&, Y&, WkD&, j&
If Cbmonth.Value = "" Or Cbyear.Value = "" Then Exit Sub
Select Case Calendar.region
Case 0, 22: WkD = vbSunday: j = 1
Case 1, 2, 12, 13: WkD = vbMonday: j = 2
End Select
X = Weekday(DateSerial(Calendar.Cbyear, Calendar.Cbmonth.ListIndex + 1, 1), WkD)
NB_JOURS = Day(DateSerial(Cbyear.Value, Cbmonth.ListIndex + 2, 0))
For I = 1 To 6: Me.Controls("sem" & I) = "": Next
For I = 1 To 42
With Calendar.Controls("j" & I)
.Caption = "": .Enabled = False: .BackColor = bt2Back: .ControlTipText = ""
If I >= X And A <= NB_JOURS - 1 Then
.Visible = True: A = A + 1: .Enabled = True: .Caption = A: .BackColor = bt1Back
Y = CLng(DateSerial(Calendar.Cbyear.Value, Calendar.Cbmonth.ListIndex + 1, A))
Controls(.Tag).Caption = Evaluate("= TRUNC((" & Y & "-WEEKDAY(" & Y & "," & j & ")+11-DATE(YEAR(" & Y & "-WEEKDAY(" & Y & " ," & j & ")+4),1,1))/7)")
.BackColor = férié(I)
End If
End With
Next
End Sub
bonjour a tous
juste une petite correction pour les numéros de semaine
l'index pour weekday n'etait pas dynamique
VB:'mise ajour du clavier Public Sub ReloadClavier() Dim X&, I&, A&, NB_JOURS&, Y&, WkD&, j& If Cbmonth.Value = "" Or Cbyear.Value = "" Then Exit Sub Select Case Calendar.region Case 0, 22: WkD = vbSunday: j = 1 Case 1, 2, 12, 13, 33: WkD = vbMonday: j = 2 End Select X = Weekday(DateSerial(Calendar.Cbyear, Calendar.Cbmonth.ListIndex + 1, 1), WkD)...