Bonjour j'arrive pas à exécuter le code suivant:



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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
' AddData Macro
' Macro recorded 15/05/98 by MCC-DEV
'
'
Sub AddData(ByRef iCurrentLine As Integer)
 
    Dim vCurrentCell As Variant
    Dim bLastLine As Boolean
    Dim sTypeDepot As String
    Dim iHauteurTotale As Integer
    Dim iHauteurPage As Integer
    Dim bEndOfActionnaire As Boolean
    Dim iNoEnreg As Integer
    Dim iNbFichier As Integer
    Dim iLenghtBarcode As Integer ' nouvelle variable pour code barre'
 
 
    Sheets("Datas").Select
    Sheets("Datas").Range("A2").Select
    Set vCurrentCell = Range("A2")
    sBarcode = Range("A2")
    sFirstActionnaire = Range("K2")
    bEndOfActionnaire = False
    iHauteurPage = 26 ' Exprimée en cellules
    iHauteurTotale = 2 ' hauteur de l'en-tete
    iNoEnreg = 0
    iNbFichier = 1
 
    ' pour chaque enregistrement
    Do While Not IsEmpty(vCurrentCell)
        iNoEnreg = iNoEnreg + 1
        Application.StatusBar = "Enregistrement " & iNoEnreg & "/" & iNbEnreg & " (" & CInt(iNoEnreg / iNbEnreg * 100) & "%)"
        ' Si nouveau actionnaire
        If vCurrentCell <> ActiveCell.Offset(-1, 0).Value Then
            iHauteurTotale = iHauteurTotale + 8
            iCurrentLine = CopieActionnaire.CopieActionnaire(iCurrentLine)
            bEndOfActionnaire = False
            bLastLine = AddDataActionnaire.AddDataActionnaire(iCurrentLine)
        Else
            ' Meme actionnaire
            ActiveCell.Offset(0, 7).Select ' on se positionne sur le type de dépôt
            bLastLine = AddDataActionnaire.AddDataActionnaire(iCurrentLine)
        End If
        If bLastLine Then
            bEndOfActionnaire = True
            ' on encadre l'actionnaire
            'AddReversedSN.AddReversedSN
            Border.Border
        End If
 
        Sheets("Datas").Select
        Set vCurrentCell = ActiveCell.Offset(0, 0)
        ActiveCell.Offset(0, 0).Select
 
        If IsEmpty(vCurrentCell) Then
            InsererReversedSN.InsererReversedSN
 
             ActiveCell.EntireRow.RowHeight = 52.8
 
                ActiveCell.Offset(0, 2).Select
                iLenghtBarcode = 5 - Len(sBarcode)
                ActiveCell.FormulaR1C1 = Chr$(126) & String(iLenghtBarcode, "0") & sBarcode & Chr$(126)
                Selection.Font.Name = "Code 39"
                Selection.Font.Size = 26
                Selection.HorizontalAlignment = xlRight
                Sheets("FeuillePresence").Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, -1)).Select
                Selection.BorderAround Weight:=xlThin, ColorIndex:=xlAutomatic
 
                ActiveCell.Offset(0, 2).Select
                InsererReversedSN.InsererReversedSN
                Selection.HorizontalAlignment = xlRight
                ActiveCell.Offset(0, -3).Select
        Else
            ' saut de page ?
            If (bEndOfActionnaire = True) Then ' (iHauteurTotale >= iHauteurPage) And
                InsererReversedSN.InsererReversedSN
 
                ActiveCell.EntireRow.RowHeight = 52.8
 
                ActiveCell.Offset(0, 2).Select
                iLenghtBarcode = 5 - Len(sBarcode)
                ActiveCell.FormulaR1C1 = Chr$(126) & String(iLenghtBarcode, "0") & sBarcode & Chr$(126)
                Selection.Font.Name = "Code 39"
                Selection.Font.Size = 26
                'remplacement n°boitier par le code barre
 
                'ActiveCell.FormulaR1C1 = ": REITIOB °N"
               ' Selection.Font.Name = "MCC Font"
                'Selection.Font.Size = 20
                Selection.HorizontalAlignment = xlRight
                Sheets("FeuillePresence").Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, -1)).Select
                Selection.BorderAround Weight:=xlThin, ColorIndex:=xlAutomatic
 
                ActiveCell.Offset(0, 2).Select
                InsererReversedSN.InsererReversedSN
                Selection.HorizontalAlignment = xlRight
                ActiveCell.Offset(0, -3).Select
 
                ' Insertion d'un saut de page
                If Worksheets.HPageBreaks.Count < 1000 Then
                    ActiveCell.Offset(1, 0).PageBreak = xlManual
 
                    If Not (IsEmpty(vCurrentCell)) Then
                        ActiveCell.Offset(1, 0).Select
                        InsererEnTete.InsererEnTete
                        iHauteurTotale = 3
                        bEndOfActionnaire = False
                        Sheets("Datas").Select
                        sBarcode = ActiveCell.Offset(0, 0)
                        sFirstActionnaire = ActiveCell.Offset(0, 10)
                    End If
 
                Else
                    Sheets("FeuillePresence").Select
                    Sheets("FeuillePresence").Range(ActiveCell.Offset(0, 0), "D3").Select
                    ActiveWorkbook.Names.Add Name:="Datas", RefersToR1C1:= _
                    Selection()
 
                    ActiveWorkbook.Save ' Pour le premier fichier FPP.xls
                    ActiveWorkbook.SaveAs "FPP" & iNbFichier & ".xls"
                    iNbFichier = iNbFichier + 1
                    Sheets("FeuillePresence").Select
                    Worksheets("FeuillePresence").Range("Datas").EntireRow.Delete
 
                    ' mise au format text des colonnes A et I
                    Columns("A:A").Select
                    Selection.NumberFormat = "@"
                    Columns("I:I").Select
                    Selection.NumberFormat = "@"
                    Range("A3").Select
                    Sheets("Datas").Select
                    sBarcode = ActiveCell.Offset(0, 0)
                    sFirstActionnaire = ActiveCell.Offset(0, 10)
                End If
 
            End If
        End If
    Loop 'fin des enregistrements
 
    Sheets("FeuillePresence").Select
    'delimitation de la zone contenant les donnees
    Sheets("FeuillePresence").Range(ActiveCell.Offset(0, 0), "D3").Select
    ActiveWorkbook.Names.Add Name:="Datas", RefersToR1C1:= _
        Selection()
    ActiveWorkbook.SaveAs "FPP" & iNbFichier & ".xls"
    Range("A3").Select
End Sub

J'ai l'erreur 5 :Invalid procedure call or argument.
En mode debogage je remarque que cette erreur est dûe à la ligne: ActiveCell.FormulaR1C1 = Chr$(126) & String(iLenghtBarcode, "0") & sBarcode & Chr$(126).

Quelqu'un a déjà eu ce genre de bug?

Merci d'avance de votre aide.