Sub Insere_Imgs()
'MJ
'Stop
Efface_Images
For Each cell In Range("B2:B" & Cells(65536, 2).End(xlUp).Rows.Row)
cell.Select
If Right(cell, 4) = ".jpg" Or Right(cell, 4) = ".JPG" Or Right(cell, 4) = ".Jpg" Then Insere_redimensionne_Image
Next
'Redimensionne_Images_avec_Cellules
ActiveSheet.DrawingObjects.Select
Selection.Placement = xlMoveAndSize
Cells(1, 1).Select
Cells(2, 1).Select
End Sub
Sub Insere_redimensionne_Image()
'MichelXLd adaptation MJ
'La Dll wiaaut.dll doit être chargée (voir lien çi dessous).
'http://www.microsoft.com/downloads/details.aspx?FamilyID=a332a77a-01b8-4de6-91c2-b7ea32537e29&DisplayLang=en
Dim Img As Object, IP As Object
On Error Resume Next
Kill "C:\Thumb" & ActiveCell
'Stop
Set Img = CreateObject("WIA.ImageFile")
Set IP = CreateObject("WIA.ImageProcess")
'Img.LoadFile "C:\Documents and Settings\michel\dossier\fourmiz.JPG"
Img.LoadFile ActiveCell.Offset(0, -1) & "\" & ActiveCell
IP.Filters.Add IP.FilterInfos("Scale").FilterID
'mettre ici les valeurs de largeur et hauteur d'image
IP.Filters(1).Properties("MaximumWidth") = Cells(1, 11)
IP.Filters(1).Properties("MaximumHeight") = Cells(1, 11)
Set Img = IP.Apply(Img)
'Img.SaveFile "C:\Documents and Settings\michel\dossier\fourmizThumbnail.JPG"
Img.SaveFile "C:\Thumb" & ActiveCell
'problème sur Xl2007
ActiveSheet.Pictures.Insert("C:\Thumb" & ActiveCell).Select
'Pour XL2007 Décocher les 2 lignes suivantes
'Selection.Cut
'ActiveSheet.Paste
'Pour Xl2007
Kill "C:\Thumb" & ActiveCell
End Sub