1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| ' Export the document in csv file format
' Macro recorded 28/10/2006 by Patrick DUBERNET
'
Public Sub ExportCsv()
Dim LigneIn As String
Dim LigneExcel As Integer
' récupération du nombre de fichier à traiter et le nombre de filtres -------
Call countInFiles
LigneExcel = 2
'Inscrire le contenu d'une feuille Excel dans une autre ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
LigneIn = Sheets("Result").Cells(LigneExcel, 3)
If LigneIn = "" Then
MsgBox " Not Data transfered, the entry list is empty ! ", vbCritical, "Caution"
Exit Sub
Else
End If
For LigneExcel = 2 To frmGenerator.nbrEntries
Sheets("referenceFile").Cells(LigneExcel - 1, 1) = Sheets("Result").Cells(LigneExcel, 1)
Sheets("referenceFile").Cells(LigneExcel - 1, 2) = Sheets("Result").Cells(LigneExcel, 3)
Next LigneExcel
Sheets("Memory").Cells(2, 5) = ActiveWorkbook.FullName
'exporte le fichier ------------------------------------------------------------------------
Sheets("referenceFile").SaveAs Filename:=Sheets("Memory").Cells(2, 4) & "\referenceFile.csv", FileFormat:=xlCSV, CreateBackup:=False
'sauvegarde le fichier excel tel quel -----------------------------------------------------
ActiveWorkbook.SaveAs Filename:=Sheets("Memory").Cells(2, 5), FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
MsgBox "save document under CSV format(referenceFile.csv)", vbExclamation, "Export information message"
End Sub |
Partager