Sub code_champs1()
'Call M1_numerisation_image.Creer_image_test_jpg
Sheets("Code").Select
[a2:a400].ClearContents
ActiveWorkbook.Worksheets("Code").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Code").AutoFilter.Sort.SortFields.Add2 Key:=Range( _
"B1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Code").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'nom de l'image
NomImg = "Control_Code_Champ.jpg"
Dim det_Headers(336)
Set objShell = CreateObject("Shell.Application")
'Set objfolder = objShell.Namespace("C:\Users\Utilisateur\Pictures\test")
'Set objfolder = ThisWorkbook.Path & ("Control_Code_Champ.jpg")
Set objFolder = objShell.Namespace(ThisWorkbook.Path & "\")
Workbooks(1).Sheets(1).Activate
For i = 1 To 336
det_Headers(i) = objFolder.GetDetailsOf(objFolder.Items, i - 1)
ActiveSheet.Cells(i + 2, 1) = det_Headers(i)
Next
ActiveWorkbook.Worksheets("Code").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Code").AutoFilter.Sort.SortFields.Add2 Key:=Range( _
"A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Code").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub