Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

import de fichier XlS TXT ou CSV avec VBA

1 réponse
Avatar
denis le breton
' ------------ sous module d'ouverture de fichier traitant séparément les
fichiers de type 'CSV'
Dim wb As Workbook
With Application
.ScreenUpdating = False
.DisplayAlerts = False
Application.Dialogs(xlDialogOpen).Show
fic = ActiveWorkbook.Name
ext = Right(fic, 3)
' ---------- ouverture fichier de type csv ----------------------
If ext = "csv" Then
Set wb = .Workbooks.Open(fic)
wb.Sheets(1).Columns(1).TextToColumns Range("A1"),
xlTextQualifierDoubleQuote, , False, , , , , True, ";", Array(1, 4)
End If
' ---------- fin de l'ouverture fichier de type csv ----------------------
.ScreenUpdating = True
.DisplayAlerts = False
End With
' ------------ fin du sous module d'ouverture de fichier

Et voilà si cela peut servir à quelqu'un.
Et rendons à César ce qui appartient à Jules
adapté de DJ SKOT (---.w80-8.abo.wanadoo.fr)
http://www.excel-downloads.com/html/French/forum/messages/1_67502_67502.htm

Bon courage à toutes et à tous
Denis le breton

1 réponse

Avatar
PHIL
quelle serait le code si je fait un export de ma feuille 2 EN XLS VERS DU csv.

MERCI


' ------------ sous module d'ouverture de fichier traitant séparément les
fichiers de type 'CSV'
Dim wb As Workbook
With Application
.ScreenUpdating = False
.DisplayAlerts = False
Application.Dialogs(xlDialogOpen).Show
fic = ActiveWorkbook.Name
ext = Right(fic, 3)
' ---------- ouverture fichier de type csv ----------------------
If ext = "csv" Then
Set wb = .Workbooks.Open(fic)
wb.Sheets(1).Columns(1).TextToColumns Range("A1"),
xlTextQualifierDoubleQuote, , False, , , , , True, ";", Array(1, 4)
End If
' ---------- fin de l'ouverture fichier de type csv ----------------------
.ScreenUpdating = True
.DisplayAlerts = False
End With
' ------------ fin du sous module d'ouverture de fichier

Et voilà si cela peut servir à quelqu'un.
Et rendons à César ce qui appartient à Jules
adapté de DJ SKOT (---.w80-8.abo.wanadoo.fr)
http://www.excel-downloads.com/html/French/forum/messages/1_67502_67502.htm

Bon courage à toutes et à tous
Denis le breton