Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

ON ERROR GOTO NEXT_FILE

1 réponse
Avatar
Marc Sylvain
Dans un de mes programmes j'utilise

Un ON ERROR GOTO NEXT_FILE dans une boucle



La premier fois que j'arrive a un code d'erreur

Il exécute le ON ERROR GOTO NEXT_FILE

Mais la seconde fois qu'il me donne un code d'erreur

le programme plante. Comment faire pour que le programme

execute toujours mon ON ERROR GOTO NEXT_FILE

dans ma boucle ?



While Nom_Fichier(Conteur) <> ""
If Verifier_ReadOnly(Nom_Fichier(Conteur)) = True Then
GoTo Next_File
End If
If Dir(Nom_Fichier(Conteur)) = "" Then GoTo Next_File

If IsFileOpen(Nom_Fichier(Conteur)) Then
GoTo Next_File
End If

Set Mydoc = ObjApp.Documents.Open(Nom_Fichier(Conteur))

'**************************************************
On Error GoTo Next_File

'**************************************************
If Mydoc.ModelLinks.Count = 0 Then
Print #1, Mydoc.FullName; " --> Aucun fichier de lier a ce dessin,
Aucun Update"
Mydoc.Close (False)
GoTo Next_File
End If
String_Name = Mydoc.ModelLinks(1).filename

Set ObjModelLink = Mydoc.ModelLinks(1)
Set ObjModelLink = Mydoc.ModelLinks.Add(filename:=String_Name)
Call ObjModelLink.GetFilesToUpdate(Long_A, Test)
If Long_A > 0 Then
Print #1, Mydoc.FullName; " --> Son Assembler a besion d'une mise a
jour, Aucun Update"
Mydoc.Close (False)
Long_A = 0
GoTo Next_File
End If
For I = 1 To Mydoc.PartsLists.Count
Call Mydoc.PartsLists(I).Delete
Next
Call Mydoc.DimensionTrackerStatistics(Chg_Dim, Detache_Dim)
Call Mydoc.AnnotationTrackerStatistics(Chg_Anno, Detache_Anno)

Mydoc.Save
Mydoc.Close
Next_File:
For I = 1 To ObjApp.Documents.Count
Print #1, ObjApp.Documents.Item(1).FullName; " --> Une erreur c'est
produit"
ObjApp.Documents.Item(1).Close
Next I
Conteur = Conteur + 1
Wend








Merci

Marc

1 réponse

Avatar
LE TROLL
On Error GoTo 0 Invalide dans la procédure en cours tout gestionnaire
d'erreurs validé.


--
Merci beaucoup, au revoir et à bientôt :o)
------
Site de MES LOGICIELS
http://irolog.free.fr
Site éditeur de MES ROMANS édités
http://irolog.free.fr/romans
mon adresse EMail
http://irolog.free.fr/ecrire/index.htm
------------------------------------------------------------------------------------
"Marc Sylvain" a écrit dans le message de news:

Dans un de mes programmes j'utilise

Un ON ERROR GOTO NEXT_FILE dans une boucle



La premier fois que j'arrive a un code d'erreur

Il exécute le ON ERROR GOTO NEXT_FILE

Mais la seconde fois qu'il me donne un code d'erreur

le programme plante. Comment faire pour que le programme

execute toujours mon ON ERROR GOTO NEXT_FILE

dans ma boucle ?



While Nom_Fichier(Conteur) <> ""
If Verifier_ReadOnly(Nom_Fichier(Conteur)) = True Then
GoTo Next_File
End If
If Dir(Nom_Fichier(Conteur)) = "" Then GoTo Next_File

If IsFileOpen(Nom_Fichier(Conteur)) Then
GoTo Next_File
End If

Set Mydoc = ObjApp.Documents.Open(Nom_Fichier(Conteur))

'**************************************************
On Error GoTo Next_File

'**************************************************
If Mydoc.ModelLinks.Count = 0 Then
Print #1, Mydoc.FullName; " --> Aucun fichier de lier a ce dessin,
Aucun Update"
Mydoc.Close (False)
GoTo Next_File
End If
String_Name = Mydoc.ModelLinks(1).filename

Set ObjModelLink = Mydoc.ModelLinks(1)
Set ObjModelLink = Mydoc.ModelLinks.Add(filename:=String_Name)
Call ObjModelLink.GetFilesToUpdate(Long_A, Test)
If Long_A > 0 Then
Print #1, Mydoc.FullName; " --> Son Assembler a besion d'une mise a
jour, Aucun Update"
Mydoc.Close (False)
Long_A = 0
GoTo Next_File
End If
For I = 1 To Mydoc.PartsLists.Count
Call Mydoc.PartsLists(I).Delete
Next
Call Mydoc.DimensionTrackerStatistics(Chg_Dim, Detache_Dim)
Call Mydoc.AnnotationTrackerStatistics(Chg_Anno, Detache_Anno)

Mydoc.Save
Mydoc.Close
Next_File:
For I = 1 To ObjApp.Documents.Count
Print #1, ObjApp.Documents.Item(1).FullName; " --> Une erreur c'est
produit"
ObjApp.Documents.Item(1).Close
Next I
Conteur = Conteur + 1
Wend








Merci

Marc