Comment configurer Excel pour toujours importer toutes les colonnes de fichiers CSV en texte ?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Comment configurer Excel pour toujours importer toutes les colonnes de fichiers CSV en texte ?

Message par Clippy »

Comment configurer Excel pour toujours importer toutes les colonnes de fichiers CSV en texte ?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Comment configurer Excel pour toujours importer toutes les colonnes de fichiers CSV en texte ?

Message par Clippy »

Ceci fonctionne :

```
Sub OpenCsvAsText(ByVal strFilepath As String)

Dim intFileNo As Integer
Dim iCol As Long
Dim nCol As Long
Dim strLine As String
Dim varColumnFormat As Variant
Dim varTemp As Variant

'// Read first line of file to figure out how many columns there are
intFileNo = FreeFile()
Open strFilepath For Input As #intFileNo
Line Input #intFileNo, strLine
Close #intFileNo
varTemp = Split(strLine, ",")
nCol = UBound(varTemp) + 1

'// Prepare description of column format
ReDim varColumnFormat(0 To nCol - 1)
For iCol = 1 To nC
```
Répondre

Revenir à « Excel & VBA »