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
| Sub Ouverture_TXT()
Dim lignefin As Integer
Dim wrk As Workbook
Fichiers = Application.GetOpenFilename("Fichiers Texte (*.txt), *.txt", , , , True)
If IsArray(Fichiers) Then
For i = LBound(Fichiers, 1) To UBound(Fichiers, 1)
Workbooks.OpenText Fichiers(i) _
, Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1)), _
TrailingMinusNumbers:=True
Set wrk = ActiveWorkbook
lignefin = ActiveSheet.UsedRange.Rows.Count
Range("A3:H" & lignefin - 1).Copy
Windows("Utilisation_postes.xls").Activate
lignefin = ActiveSheet.UsedRange.Rows.Count
Range("A" & lignefin + 2).Select
ActiveSheet.Paste
Cells.EntireColumn.AutoFit
Application.DisplayAlerts = False
wrk.Close False
Application.DisplayAlerts = True
Next i
End If
End Sub |
Partager