Bonjour à tous,
Après plusieurs recherches sur le net, je me permets de demander votre aider en VBA.
Dans mon fichier Excel j'ai plusieurs onglets, et je voudrais créer une macro pour exporter un seul onglet et l'enregistrer en CSV. (Pour ça j'y suis arrivé)
Le problème est que je n'arrive pas, à faire un "enregistre sous" en choisissant n'importe quelle destination du fichier et en choisissant n'importe quel nom de mon fichier quand je l'export.
Voici mon code :
Sub SaveCSV()
Dim Chemin As String, Fichier As String
Set rep = Application.FileDialog(msoFileDialogFolderPicker)
If rep.Show <> 0 Then
Application.ScreenUpdating = False
Chemin = rep.SelectedItems(1) & "\"
Fichier = "Import_DOE_" & Format(Now, "yyyymmdd")
ThisWorkbook.Worksheets("Feuil1").Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Chemin & Fichier, FileFormat:=xlCSV, Local:=True
ActiveWorkbook.Close
Application.DisplayAlerts = True
MsgBox "Votre fichier a été exporté", , "Export DOE": Exit Sub
End If
End Sub
Si vous avez une petite solution à m'apporter.
Merci à vous