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
|
Sub select_file_name()
Dim Filename As Variant
Dim N As Integer
Dim current_row As Double
Dim Ar() As String
Filename = Application.GetOpenFilename(, , , , True)
If IsArray(Filename) Then
For N = LBound(Filename) To UBound(Filename) ' For each file selected in GetOpenFilename Windows
ActiveSheet.Cells(ActiveCell.Row + N - 1, 1).Value = CStr(Filename(N)) ' Save first column: name of the file
ActiveSheet.Cells(ActiveCell.Row + N - 1, 2).Value = import_lenght(CStr(Filename(N)))
If ActiveSheet.Cells(2, 3).Value > 0 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 3).Value = import_capsule_position(CStr(Filename(N)), 1)
End If
If ActiveSheet.Cells(2, 3).Value > 1 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 4).Value = import_capsule_position(CStr(Filename(N)), 2)
End If
If ActiveSheet.Cells(2, 3).Value > 2 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 5).Value = import_capsule_position(CStr(Filename(N)), 3)
End If
If ActiveSheet.Cells(2, 3).Value > 3 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 6).Value = import_capsule_position(CStr(Filename(N)), 4)
End If
If ActiveSheet.Cells(2, 3).Value > 4 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 7).Value = import_capsule_position(CStr(Filename(N)), 5)
End If
If ActiveSheet.Cells(2, 3).Value > 5 Then
ActiveSheet.Cells(ActiveCell.Row + N - 1, 8).Value = import_capsule_position(CStr(Filename(N)), 6)
End If
Next N
'ActiveSheet.Cells(ActiveCell.Row, 2).Value = "= "
End If
'Pour ne pas garder en memoire le dossier du dernier fichier saisi avec GetOpenFilename
ChDir ActiveWorkbook.Path 'place dans le bon répertoire
End Sub |
Partager