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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| Do While Quitter = False
If i <> 0 And i <> 6 And i <> 14 And i <> 26 And i <> 38 And i <> 50 And i <> 55 And i <> 63 And i <> 70 And i <> 78 Then
' création d'une boucle pour obtenir plusieurs fichiers de données dans différentes colonnes à partir d'une acquisition
Nom_fichier = Feuil8.Range("C8").Offset(0, i).Value
'permet de connaître le nom du fichier à acquérir
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;F:\degrémont\last one\Données Macro\" & Nom_fichier & ".txt" _
, Destination:=Range("CD9"))
.Name = Nom_fichier
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(5, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
'acquisition d'un fichier text sous excell
If i <> 1 And i <> 7 And i <> 15 And i <> 27 And i <> 39 And i <> 51 And i <> 56 And i <> 64 And i <> 71 And i <> 79 Then
Else
End If
Else
If i = 0 Or i = 6 Or i = 14 Or i = 26 Or i = 38 Or i = 50 Or i = 55 Or i = 63 Or i = 70 Then
Else
Quitter = True
End If
End If
i = i + 1
Loop
End Sub |
Partager