Erreur lors de l'initialisation de l'userform

Bonjour à toutes et à tous

Voila j'ai un soucis avec un macro qui me permet de faire la conciliation médicamenteuse. Lorsque que l'execute j'ai assez régulierement le message d'erreur suivant

Nom d’événement de problème: APPCRASH

Nom de l’application: EXCEL.EXE

Version de l’application: 15.0.4569.1504

Horodatage de l’application: 52c5e9e1

Nom du module par défaut: VBE7.DLL

Version du module par défaut: 7.1.10.42

Horodateur du module par défaut: 52338d4e

Code de l’exception: c0000005

Décalage de l’erreur: 0003a3a6

Version du système: 6.1.7601.2.1.0.256.48

Identificateur de paramètres régionaux: 1036

Informations supplémentaires sur le problème :

LCID: 1036

skulcid: 1036

Lire notre déclaration de confidentialité en ligne :

Si la déclaration de confidentialité en ligne n’est pas disponible, lisez la version hors connexion :

C:\Windows\system32\fr-FR\erofflps.txt

Je n'arrive pas à la résoudre. Lorsque je fait l'execution pas à pas aucune ligne ne créer d'erreur.

Voici les lignes de codes lorsque j'initialise l'UF.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public ligne_totale As Long, PO As Long, début_PO As Date, MT As Long, début_MT As Date, P As Long, début_P As Date, SPE As Long, début_SPE As Date, c As Long, début_C As Date, DPI As Long, début_DPI As Date, DP As Long, début_DP As Date, ES As Long, début_ES As Date, QP As Long, début_QP As Date, M As Long, début_M As Date, numero_ligne_aide As Long, numero_ligne_BMO As Long, b As Long, sauvegarde_patient As Long, lancement_OMA As Long, lancement_aide As Long, début As Date, timer_globale As Long, temps_prec As Date, tps As Date, valide As String
Dim objet_BMO(22, 11), objet_aide(22, 12), objet_OMA(22, 14) As Long

Private Sub UserForm_Initialize()
' j'ai cacher les textbox DCI sur la feuille aide à la prescription sous les autres
Sleep (100)
timer_globale = 0
b = 2
Sleep (10)
lancement_OMA = 0
lancement_aide = 0
TextBox2.List = Sheets("liste_feuil").Range("A1:A" & Sheets("Liste_feuil").Range("A65536").End(xlUp).Row).Value

Sleep (100)
ComboBox1.List = Sheets("Paramétrage").Range("A2:A4").Value
ComboBox3.List = Sheets("Paramétrage").Range("C1:C2").Value
ComboBox44.List = Sheets("Antécédant").Range("A2:A" & Sheets("Antécédant").Range("A65536").End(xlUp).Row).Value
ComboBox50.List = Sheets("Antécédant").Range("B2:B" & Sheets("Antécédant").Range("B65536").End(xlUp).Row).Value
ComboBox58.List = Sheets("Antécédant").Range("C2:C" & Sheets("Antécédant").Range("C65536").End(xlUp).Row).Value
ComboBox63.List = Sheets("Antécédant").Range("D2:D" & Sheets("Antécédant").Range("D65536").End(xlUp).Row).Value
ComboBox65.List = Sheets("Antécédant").Range("E2:E" & Sheets("Antécédant").Range("E65536").End(xlUp).Row).Value
ComboBox71.List = Sheets("Antécédant").Range("F2:F" & Sheets("Antécédant").Range("F65536").End(xlUp).Row).Value
ComboBox76.List = Sheets("Antécédant").Range("G2:G" & Sheets("Antécédant").Range("G65536").End(xlUp).Row).Value
Sleep (100)
Sheets("tableau_officiel_produit").Range("A2:U" & Sheets("tableau_officiel_produit").Range("B65536").End(xlUp).Row).Sort Key1:=Sheets("tableau_officiel_produit").Range("B2"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Sleep (100)
ComboBox81.List = Sheets("tableau_officiel_produit").Range("B2:B" & Sheets("tableau_officiel_produit").Range("B65536").End(xlUp).Row).Value
Sleep (100)
TextBox10.List = Sheets("contact").Range("A3:A" & Sheets("contact").Range("A65536").End(xlUp).Row).Value
TextBox22.List = Sheets("contact").Range("E3:E" & Sheets("contact").Range("E65536").End(xlUp).Row).Value
TextBox18.List = Sheets("contact").Range("H3:H" & Sheets("contact").Range("H65536").End(xlUp).Row).Value
Sleep (100)
Sheets("Paramétrage").Range("H1:H" & Sheets("Paramétrage").Range("H65536").End(xlUp).Row).Sort Key1:=Sheets("Paramétrage").Range("H1"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Sheets("Paramétrage").Range("I1:I" & Sheets("Paramétrage").Range("I65536").End(xlUp).Row).Sort Key1:=Sheets("Paramétrage").Range("I1"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
TextBox27.List = Sheets("Paramétrage").Range("H1:H" & Sheets("Paramétrage").Range("H65536").End(xlUp).Row).Value
TextBox390.List = Sheets("Paramétrage").Range("H1:H" & Sheets("Paramétrage").Range("H65536").End(xlUp).Row).Value
TextBox574.List = Sheets("Paramétrage").Range("I1:I" & Sheets("Paramétrage").Range("I65536").End(xlUp).Row).Value

Sleep (100)

timer_textbox = Array(29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 576)
For Each i In timer_textbox
Me.Controls("TextBox" & i).Value = TimeSerial(0, 0, 0)
Next

objet_BMO(1, 1) = 3
objet_BMO(1, 2) = 12
objet_BMO(1, 3) = 81
objet_BMO(1, 4) = 48
objet_BMO(1, 5) = 49
objet_BMO(1, 6) = 50
objet_BMO(1, 7) = 51
objet_BMO(1, 8) = 52
objet_BMO(1, 9) = 53
objet_BMO(1, 10) = 54
Sleep (100)
objet_aide(1, 1) = 188
objet_aide(1, 2) = 189
objet_aide(1, 3) = 190
objet_aide(1, 4) = 101
objet_aide(1, 5) = 191
objet_aide(1, 6) = 192
objet_aide(1, 7) = 193
objet_aide(1, 8) = 194
objet_aide(1, 9) = 195
objet_aide(1, 10) = 196
objet_aide(1, 11) = 391
Sleep (100)
objet_OMA(1, 1) = 413
objet_OMA(1, 2) = 414
objet_OMA(1, 3) = 121
objet_OMA(1, 4) = 122
objet_OMA(1, 5) = 415
objet_OMA(1, 6) = 416
objet_OMA(1, 7) = 417
objet_OMA(1, 8) = 418
objet_OMA(1, 9) = 419
objet_OMA(1, 10) = 420
objet_OMA(1, 11) = 203
objet_OMA(1, 12) = 208

Sleep (100)
For i = 2 To 21
objet_aide(i, 1) = objet_aide(i - 1, 1) + 9
objet_aide(i, 2) = objet_aide(i - 1, 2) + 9
objet_aide(i, 3) = objet_aide(i - 1, 3) + 9
objet_aide(i, 4) = objet_aide(i - 1, 4) + 1
objet_aide(i, 5) = objet_aide(i - 1, 5) + 9
objet_aide(i, 6) = objet_aide(i - 1, 6) + 9
objet_aide(i, 7) = objet_aide(i - 1, 7) + 9
objet_aide(i, 8) = objet_aide(i - 1, 8) + 9
objet_aide(i, 9) = objet_aide(i - 1, 9) + 9
objet_aide(i, 10) = objet_aide(i - 1, 10) + 9
objet_aide(i, 11) = objet_aide(i - 1, 11) + 1
Next

Sleep (100)
For i = 2 To 21
objet_BMO(i, 1) = objet_BMO(i - 1, 1) + 10
objet_BMO(i, 2) = objet_BMO(i - 1, 2) + 10
objet_BMO(i, 3) = objet_BMO(i - 1, 3) + 1
objet_BMO(i, 4) = objet_BMO(i - 1, 4) + 7
objet_BMO(i, 5) = objet_BMO(i - 1, 5) + 7
objet_BMO(i, 6) = objet_BMO(i - 1, 6) + 7
objet_BMO(i, 7) = objet_BMO(i - 1, 7) + 7
objet_BMO(i, 8) = objet_BMO(i - 1, 8) + 7
objet_BMO(i, 9) = objet_BMO(i - 1, 9) + 7
objet_BMO(i, 10) = objet_BMO(i - 1, 10) + 7
Next

Sleep (100)
For i = 2 To 21
objet_OMA(i, 1) = objet_OMA(i - 1, 1) + 8
objet_OMA(i, 2) = objet_OMA(i - 1, 2) + 8
objet_OMA(i, 3) = objet_OMA(i - 1, 3) + 2
objet_OMA(i, 4) = objet_OMA(i - 1, 4) + 2
objet_OMA(i, 5) = objet_OMA(i - 1, 5) + 8
objet_OMA(i, 6) = objet_OMA(i - 1, 6) + 8
objet_OMA(i, 7) = objet_OMA(i - 1, 7) + 8
objet_OMA(i, 8) = objet_OMA(i - 1, 8) + 8
objet_OMA(i, 9) = objet_OMA(i - 1, 9) + 8
objet_OMA(i, 10) = objet_OMA(i - 1, 10) + 8
objet_OMA(i, 11) = objet_OMA(i - 1, 11) + 6
objet_OMA(i, 12) = objet_OMA(i - 1, 12) + 6
Next
Sleep (100)
Me.MultiPage1.Value = 0

End Sub

Comme c'est un fichier avec des données patients je suis entrain d'en créer un vierge pour le partager avec vous.

[EDIT] voila j'ai fait un faux fichier. il faut essayer de modifier le patient 72

Merci d'avance pour vos réponse.

Cordialement

quelqu'un aurai t'il un début d'idée ?

Bonjour,

Ton classeur ne semble pas exploitable : Le code fat référence à une feuille "Totale" qui n'existe pas.

Private Sub lecture()
Set ligne_synthese = Sheets("Synthèse").Range("B3:B" & Sheets("Synthèse").Range("B65536").End(xlUp).Row).Find(TextBox2.Value, lookat:=xlWhole)
Set ligne = Sheets("Totale").Range("A2:A" & Sheets("Totale").Range("A65536").End(xlUp).Row).Find(TextBox2.Value, lookat:=xlWhole)
'...

A+

j'ai supprimer la feuille totale pour raison de confidentialité mais elle existe sinon

Bonjour Charles,

Si tu dors sans oreiller, alors tu peux bien dormir sans parenthèses !

ainsi, au lieu de Sleep (100) et Sleep (10) tu peux mettre plus simplement : Sleep 100 et Sleep 10

NB : pour Sleep, c'est en millisecondes, pas en secondes ! 1000 millisecondes = 1 seconde

➯ Sleep 100 ou Sleep 10, c'est ultra-court car moins d'une seconde !


Pour ton problème, à tout hasard, essaye avec cette déclaration :

Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

À part ça, j'ai pas d'autre solution à proposer.

dhany

Merci

du coup j'avais rajouter le sleep car je trouvai que ça plantai moins....

j'ai supprimé tous les sleeps et wait et maitenant tout fonctionne

Je vous remerci

Du coup, maintenant il peut dormir sans sleep !

C'est bon

A+

Rechercher des sujets similaires à "erreur lors initialisation userform"