Convertir un fichier excel en csv avec tabulation

soltaniismael Messages postés 1 Statut Membre -  
 Maurice -
Bonjour à tous,

J'ai besoin de convertir mon fichier Excel en CSV et j'aimerais que mon délimiteur soit une tabulation (csv with tab as the delimiter). Quelqu'un peut-il me donner un coup de main s'il vous plait ?

1 réponse

  1. Maurice
     
    Bonjour
    Voila une macro csv en tabulation
    a toi de modifier la Plage

    Sub ExportVbtab()
    Application.ScreenUpdating = False
    'Nom = ActiveSheet.Name
    Nom = "Test"
    Ext = ".csv"
    Fichier = Nom & Ext
    Chemin = ActiveWorkbook.Path & Application.PathSeparator
    CheminFiche = Chemin & Fichier
    'Sep = ";"
    Sep = vbTab
    Nlig = Cells(Rows.Count, 1).End(xlUp).Row
       Set Plage = Range("A1:Y" & Nlig)
          Open CheminFiche For Output As #1
             For Each Lig In Plage.Rows
                Tmp = ""
                   For Each Cel In Lig.Cells
                      Tmp = Tmp & CStr(Cel.Text) & Sep
                   Next
                Print #1, Tmp
             Next
          Close
       Set Plage = Nothing
    Application.ScreenUpdating = True
    MsgBox "Terminer"
    End Sub
    

    A+
    Maurice
    0