Bonjour François,
Bonjour le Forum,
Le code ci-dessous permet de savoir si un fichier est ouvert :
On Error GoTo WbNotOpen
Set Wb = Workbooks("" & Mon_Fichier & "")
WbNotOpen:
MsgBox "Le fichier n'est pas ouvert", vbCritical
Et celui-ci dessous de sauvegarder un fichier par dessus l'original, et au format CSV :
Application.DisplayAlerts = False
Wb.SaveAs Filename:=Wb.Path & "\" & Wb.Name, FileFormat:=xlCSV, CreateBackup:=False
Application.DisplayAlerts = True
Donc sa donne le code :
Sub SaveCSV()
Dim Wb As Workbook
On Error GoTo WbNotOpen
Set Wb = Workbooks("" & Mon_Fichier & "")
Application.DisplayAlerts = False
Wb.SaveAs Filename:=Wb.Path & "\" & Wb.Name, FileFormat:=xlCSV, CreateBackup:=False
Application.DisplayAlerts = True
Exit Sub
WbNotOpen:
MsgBox "Le fichier n'est pas ouvert", vbCritical
End Sub
Je te laisse tester et revenir vers nous
A dispo!