Enregistrer un fichier txt avec nombres à virgules

ADS74 Messages postés 2 Date d'inscription   Statut Membre Dernière intervention   -  
ADS74 Messages postés 2 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

J'ai un fichier excel à enregistrer en .txt, jusque là tout va bien sauf que dans mon fichier excel il y a des nombres à virgules et que ceux-ci sont transformés avec des points dans le .txt. Comment faire pour que les nombres gardent leur format dans le fichier texte?

Voici le bout de code correspondant:

ActiveWorkbook.SaveAs Filename:="C:\FichierImportWS\WS_" & Format(Date, "yyyymmdd") & Marq_fichier & ".txt", FileFormat:=xlText

Merci de votre aide,
A voir également:

1 réponse

Maurice
 
Bonjour

voila une vielle macro export
a toi de modifier la plage

Sub VerifRepertoire()
Chemin = ActiveWorkbook.Path & "\"
MonRep = Chemin & "Export"
If Dir(MonRep, vbDirectory) = "" Then
MkDir (MonRep)
End If
Export MonRep
End Sub

Sub Export(Chemin)
NonFic = ActiveSheet.Name
Ext = ".txt"
Fichier = NonFic & Ext
CheminFiche = Chemin & "\" & Fichier
Sep = ";"
' selection de la Plage TXT
Set Plage = Range("B2:G" & Range("B" & Rows.Count).End(xlUp).Row)
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
MsgBox "Votre fichier TXT a été créé avec succès!"
End Sub

A+
Maurice
0
ADS74 Messages postés 2 Date d'inscription   Statut Membre Dernière intervention  
 
Ca fonctionne,
Merci beaucoup
0