Sub Macro1()
'
Dim FullMesh As String, repertoire As String
Dim prefixName As String
prefixName = Range("F18").Value
Application.ScreenUpdating = False
With Sheets("Basic") 'on récupère le YES ou NO
FullMesh = UCase(.Range("B3"))
End With
repertoire = ActiveWorkbook.Path 'on récupère le répertoire actif
Application.DisplayAlerts = False 'on évite les alertes
With Sheets("P-Router1") 'on copie la feuille
.Copy
End With
'ActiveWorkbook.SaveAs Filename:=repertoire & "\P-Router1.txt", FileFormat:=xlTextMSDOS, CreateBackup:=False 'on enregistre au format TXT
ActiveWorkbook.SaveAs Filename:=repertoire & "\" & prefixName & "P-Router2.txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
ActiveWindow.Close 'on ferme
If FullMesh = "YES" Then 'si YES, on fait la meme chose avec le deuxième onglet
prefixName = Range("F19").Value
With Sheets("P-Router2")
.Copy
End With
ActiveWorkbook.SaveAs Filename:=repertoire & "\P-Router2.txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
ActiveWindow.Close
End If
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub