Private Sub UserForm_Initialize()
Dim Ltbx As Byte
cl.initiate Me 'instanciation des textbox taggés "Heure"
EnableEvents = True
For Ltbx = 0 To 3
Me.MultiPage1.Pages(Ltbx).Enabled = IIf(Me.MultiPage1.Value = Ltbx, True, False)
Select Case Sheets("Saisie").ComboMenus
Case "Enregistrer un(e) employé(e)"
Me.MultiPage1.Value = 0
Me.TextBox1.SetFocus
Me.Label1.Visible = False
Me.Cbx_Salarié.Visible = False
Case "Enregistrer le planning horaires"
Me.MultiPage1.Value = 1
Me.Cbx_Salarié.SetFocus
Me.MultiPage1.Pages(0).Enabled = True
Case "Editer les plannings"
Me.MultiPage1.Value = 2
Me.Cbx_Salarié.SetFocus
Me.MultiPage1.Pages(0).Enabled = True
Case "Enregistrer un contrat horaires"
Me.MultiPage1.Value = 3
Me.Cbx_Salarié.SetFocus
Me.MultiPage1.Pages(0).Enabled = True
End Select
Next Ltbx
Me.Cbx_Salarié.Clear 'Chargement Combo "Salariés"
With Sheets("Liste agents").ListObjects("t_Noms")
For I = 1 To .ListRows.Count
Me.Cbx_Salarié.AddItem .DataBodyRange(I, 2)
Next I
End With
LoadLBx Me.Controls("Lbx_Employés"), Sheets("Liste agents").ListObjects("t_Noms")
If Weekday(Now, 2) <> 1 Then 'initialisation de la date du début au lundi de la semaine en cours
Me.Tbx_DebSem = Format(Now - Weekday(Now, 2) + 1, "dd/mm/yyyy")
Else
Me.Tbx_DebSem = Format(Now, "dd/mm/yyyy")
End If
For I = 1 To 7 'initialisation des checkbox à true
Me.Controls("ChBx_" & I).Value = True
Next I
Me.Cbx_Mois.Clear
For I = 1 To 12
Me.Cbx_Mois.AddItem Format(DateSerial(Year(Now), I, 1), "mmmm")
Next I
Me.Tbx_Année = Year(Now)
For Each pag In MultiPage1.Pages: lC = lC & CStr(pag.Caption): Next: minlarge = Len(lC) * 7 '!!!!!!!!!!!!!!!!!!!!!
For Each pag In MultiPage1.Pages
ReDim Preserve Mpage(0 To pag.Index)
WW = 0: HH = 0
For Each Ctrl In pag.Controls
If Ctrl.Left + Ctrl.Width + 20 > WW Then WW = Ctrl.Left + Ctrl.Width + 20: If WW < minlarge Then WW = minlarge
If Ctrl.top + Ctrl.Height + 50 > HH Then HH = Ctrl.top + Ctrl.Height + 50
Next Ctrl
Mpage(pag.Index).Width = WW: Mpage(pag.Index).Height = HH
Mpage(pag.Index).hCaption = Me.Height - Me.InsideHeight
Mpage(pag.Index).Weight_Cadre = Me.Width - Me.InsideWidth
Next pag
resizeMulti
End Sub