Salut les amis, bonsoir!
J'essaie de développer une fiche de travail sur la réservation de véhicules

mais j'ai trouvé difficile de créer une matrice dans le forum ci-dessous, cela donne des erreurs
de variable non définie "Jr_Feries", merci de vous aider de quelqu'un, suivez le code ci-dessous., merci à tous ceux qui peuvent m'aider.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
Option Explicit
 
Public Date_calendar As String
Public ChoixDate As Date
Public Txt_dt As Integer
Public USF As Object
Public Date_initiale As String
Public dt0 As Date

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
' ** http://excel.developpez.com/faq/index.php?page=Form#UFnoTitle ********************************
Public Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
 
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Const SWP_FRAMECHANGED = &H20
 
#If VBA7 Then
    Public Declare PtrSafe Function FindWindowA Lib "user32" _
        (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
    Public Declare PtrSafe Function GetWindowRect Lib "user32" _
        (ByVal hwnd As Long, lpRect As RECT) As Long
 
    Public Declare PtrSafe Function GetWindowLong Lib "user32" Alias _
        "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
 
    Public Declare PtrSafe Function SetWindowLong Lib "user32" Alias _
        "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
        ByVal dwNewLong As Long) As Long
 
    Public Declare PtrSafe Function SetWindowPos Lib "user32" _
        (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
        ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, _
        ByVal wFlags As Long) As Long
#Else
    Public Declare Function FindWindowA Lib "user32" _
        (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
    Public Declare Function GetWindowRect Lib "user32" _
        (ByVal hwnd As Long, lpRect As RECT) As Long
 
    Public Declare Function GetWindowLong Lib "user32" Alias _
        "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
 
    Public Declare Function SetWindowLong Lib "user32" Alias _
        "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
        ByVal dwNewLong As Long) As Long
 
    Public Declare Function SetWindowPos Lib "user32" _
        (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
        ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, _
        ByVal wFlags As Long) As Long
#End If

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Sub Affiche(oUSF As Object, oControl As String, Optional oFrame As String)
Dim T As Single, L As Single
 
    If Not oFrame = "" Then
        T = oUSF.Controls(oFrame).Top + 17
        L = oUSF.Controls(oFrame).Left
    End If
 
    Set USF = oUSF
    Date_initiale = oUSF.Controls(oControl).Value
    Txt_dt = Replace(oUSF.Controls(oControl).Name, "TextBox", "")
 
    With Calendrier
        .Top = oUSF.Top + T + oUSF.Controls(oControl).Top _
               + oUSF.Controls(oControl).Height * 2 + 3
        .Left = oUSF.Left + L + oUSF.Controls(oControl).Left
        .Show
    End With
End Sub
 
Sub init_Feries(Annee As Integer)
Dim d0 As Date, i As Integer
 
    Jr_Feries = Array("Premier de l'An", "Pâques", "Lundi de Pâques", "Fête du Travail", _
         "Victoire 1945", "Ascension", "Pentecôte", "Lundi de Pentecôte", "Fête Nationale", _
         "Assomption", "Toussaint", "Armistice", "Noël", "Premier de l'An", "Pâques", _
         "Lundi de Pâques", "Fête du Travail", "Victoire 1945", "Ascension", "Pentecôte", _
         "Lundi de Pentecôte", "Fête Nationale", "Assomption", "Toussaint", "Armistice", "Noël")
 
    Dt_Feries(0) = DateSerial(Annee, 1, 1)
    d0 = DateSerial(Annee, 4, ((234 - 11 * (Annee Mod 19)) Mod 30))
    i = (d0 - DateSerial(1899, 12, 31)) / 7
    Dt_Feries(1) = CDate(Math.Round(i) * 7 - 6)
    Dt_Feries(2) = DateAdd("d", 1, Dt_Feries(1))
    Dt_Feries(3) = DateSerial(Annee, 5, 1)
    Dt_Feries(4) = DateSerial(Annee, 5, 8)
    Dt_Feries(5) = DateAdd("d", 39, Dt_Feries(1))
    Dt_Feries(6) = DateAdd("d", 49, Dt_Feries(1))
    Dt_Feries(7) = DateAdd("d", 1, Dt_Feries(6))
    Dt_Feries(8) = DateSerial(Annee, 7, 14)
    Dt_Feries(9) = DateSerial(Annee, 8, 15)
    Dt_Feries(10) = DateSerial(Annee, 11, 1)
    Dt_Feries(11) = DateSerial(Annee, 11, 11)
    Dt_Feries(12) = DateSerial(Annee, 12, 25)
 
    Dt_Feries(13) = DateSerial(Annee + 1, 1, 1)
    d0 = DateSerial(Annee + 1, 4, ((234 - 11 * ((Annee + 1) Mod 19)) Mod 30))
    i = (d0 - DateSerial(1899, 12, 31)) / 7
    Dt_Feries(14) = CDate(Math.Round(i) * 7 - 6)
    Dt_Feries(15) = DateAdd("d", 1, Dt_Feries(14))
    Dt_Feries(16) = DateSerial(Annee, 5, 1)
    Dt_Feries(17) = DateSerial(Annee, 5, 8)
    Dt_Feries(18) = DateAdd("d", 39, Dt_Feries(14))
    Dt_Feries(19) = DateAdd("d", 49, Dt_Feries(14))
    Dt_Feries(20) = DateAdd("d", 1, Dt_Feries(19))
    Dt_Feries(21) = DateSerial(Annee + 1, 7, 14)
    Dt_Feries(22) = DateSerial(Annee + 1, 8, 15)
    Dt_Feries(23) = DateSerial(Annee + 1, 11, 1)
    Dt_Feries(24) = DateSerial(Annee + 1, 11, 11)
    Dt_Feries(25) = DateSerial(Annee + 1, 12, 25)
End Sub
 
 
Function Est_Ferie(dt As Date)
Dim i As Byte
    Est_Ferie = False
    For i = 0 To UBound(Dt_Feries)
        If dt = Dt_Feries(i) Then
            Est_Ferie = True
            idx_ferie = i
        End If
    Next i
End Function