Bonjour, je n'arrive pas a gerer une erreur de type 1004 sous xlsVBA.
La 1er fois l'erreur est bien gerée la seconde fois il me renvoi la boite de dialogue 'Debogage'
Pourriez vous m'aider? .
On Error GoTo FichierATS
Path(1) = InputBox('Chemin/Path ou se trouve le(s) fichier(s):', 'DIRECTORY', 'U:\\')
ExtractionATS:
Fichier(1) = InputBox('Nom du Fichier ATS:', 'Extraction ATS', 'ats')
Workbooks.OpenText Filename:=Path(1) & Fichier(1) & '.prn', Origin:=xlWindows….
On Error GoTo AutreErreur
LA MACRO CONTINUE…………….
NouvelleExtractionATS:
Msg = 'Voulez vous formater un autre fichier ATS ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
GoTo ExtractionATS
End If
ExtractionWIP:
Fichier(2) = InputBox('Veuillez indiquer le nom de' & Chr(13) & 'votre fichier', 'NOM DU FICHIER', 'wip')
On Error GoTo FichierWIP
Workbooks.OpenText Filename:=Path(1) & Fichier(2) & '.prn', Origin:=xlWindows…….
On Error GoTo AutreErreur
LA MACRO CONTINUE…….
Msg = 'Voulez vous formater un autre fichier WIP ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
NouvelleExtractionWIP:
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
GoTo ExtractionWIP
End If
Msg = 'Voulez vous formater le fichier Expedition ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
Fichier71518:
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
Call FormatExpedition
End If
………….
EXIT SUB
'=====================GESTION DES ERREURS=========================================
NoProblemo:
MsgBox 'Extraction Terminée'
Exit Sub
FichierWIP:
MsgBox 'Le Fichier est vide ou inexistant', vbCritical, 'ERREUR EXTRACTION'
On Error Resume Next
GoTo NouvelleExtractionWIP
FichierATS:
MsgBox 'Le Fichier est vide ou inexistant' & Chr(13) & 'Extraction Suivante...', vbCritical, 'ERREUR EXTRACTION'
On Error Resume Next
GoTo NouvelleExtractionATS
END SUB
La macro complete jointe
Merci par avance.
La 1er fois l'erreur est bien gerée la seconde fois il me renvoi la boite de dialogue 'Debogage'
Pourriez vous m'aider? .
On Error GoTo FichierATS
Path(1) = InputBox('Chemin/Path ou se trouve le(s) fichier(s):', 'DIRECTORY', 'U:\\')
ExtractionATS:
Fichier(1) = InputBox('Nom du Fichier ATS:', 'Extraction ATS', 'ats')
Workbooks.OpenText Filename:=Path(1) & Fichier(1) & '.prn', Origin:=xlWindows….
On Error GoTo AutreErreur
LA MACRO CONTINUE…………….
NouvelleExtractionATS:
Msg = 'Voulez vous formater un autre fichier ATS ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
GoTo ExtractionATS
End If
ExtractionWIP:
Fichier(2) = InputBox('Veuillez indiquer le nom de' & Chr(13) & 'votre fichier', 'NOM DU FICHIER', 'wip')
On Error GoTo FichierWIP
Workbooks.OpenText Filename:=Path(1) & Fichier(2) & '.prn', Origin:=xlWindows…….
On Error GoTo AutreErreur
LA MACRO CONTINUE…….
Msg = 'Voulez vous formater un autre fichier WIP ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
NouvelleExtractionWIP:
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
GoTo ExtractionWIP
End If
Msg = 'Voulez vous formater le fichier Expedition ?' ' Définit le message.
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Définit les boutons.
Title = 'EXTRACTION Suite...' ' Définit le titre.
Fichier71518:
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' L'utilisateur a choisi Oui.
Call FormatExpedition
End If
………….
EXIT SUB
'=====================GESTION DES ERREURS=========================================
NoProblemo:
MsgBox 'Extraction Terminée'
Exit Sub
FichierWIP:
MsgBox 'Le Fichier est vide ou inexistant', vbCritical, 'ERREUR EXTRACTION'
On Error Resume Next
GoTo NouvelleExtractionWIP
FichierATS:
MsgBox 'Le Fichier est vide ou inexistant' & Chr(13) & 'Extraction Suivante...', vbCritical, 'ERREUR EXTRACTION'
On Error Resume Next
GoTo NouvelleExtractionATS
END SUB
La macro complete jointe
Merci par avance.