forme vba excel

J'ai utilisé un petit sous-programme pour insert une image dans ma feuille par

ActiveSheet.Pictures.Insert(URL).Select 

Cela fonctionne bien avec Excel 2003 (Windows), mais ne fonctionne plus avec Excel 2011 (Mac).

Par conséquent, j'ai modifié mon sous-programme (comme proposé http://www.launchexcel.com/google-maps-excel-demo/ ), mais le sous-programme s'arrête à

 theShape.Fill.UserPicture URL 

avec le message d'erreur

"-2147024894 (80070002) Fehler der Methode UserPicture des Objets FillFormat"

Le rectangle est vert!

 Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Sub Q1 () Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim wks As Worksheet Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim URL As Ssortingng Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim i As Long Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim lastRow As Long Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim theShape As Shape Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Dim pasteCell As Range Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'Feuille de travail utilisée Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Définir wks = Feuilles de travail ("Blatt1") Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'Supprimez les forms déjà existantes Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Pour chacun la forme dans wks.Shapes Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub theShape.Delete Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Suivant la forme Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'Vérifiez toutes les lignes existantes dans la colonne K Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub lastRow = Cells (Rows.Count, "K"). End (xlUp) .Row Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Pour i = 2 Pour lastRow Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'les URL sont déjà calculées et stockées dans la colonne K Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub URL = wks.Range ("K" & i) .Value Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'essayez de mettre les images dans la colonne L Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Définissez pasteCell = wks.Range ("L" & i) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub pasteCell.Select Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'Créez une forme pour mettre l'image dans Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 'ActiveSheet.Pictures.Insert (URL) .Sélectionner est obsolète et ne fonctionne plus! Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub Définissez theShape = wks.Shapes.AddShape (msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub «Remplissez la forme avec l'image après écologisation Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub theShape.Fill.BackColor.RGB = RGB (0, 255, 0) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub l'URL de l'URL de l'image Sheha.Fill.UserPicture Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200) ' fill the shape with the image after greening theShape.Fill.BackColor.RGB = RGB(0, 255, 0) theShape.Fill.UserPicture URL Next i End Sub 

Des suggestions ou des conseils? Probablement je suis aveugle comme une chauve-souris …

Avez-vous essayé la syntaxe dans le sens de cela pour définir une forme dans une URL:

 Sub Picadder() Dim Pic As Shape Set Pic = ActiveSheet.Shapes.AddPicture("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100) End Sub Sub Picadder () Sub Picadder() Dim Pic As Shape Set Pic = ActiveSheet.Shapes.AddPicture("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100) End Sub Dim Pic As Shape Sub Picadder() Dim Pic As Shape Set Pic = ActiveSheet.Shapes.AddPicture("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100) End Sub Set Pic = ActiveSheet.Shapes.AddPicture ("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100) Sub Picadder() Dim Pic As Shape Set Pic = ActiveSheet.Shapes.AddPicture("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100) End Sub 

Ce code, lorsqu'il est adapté à vos efforts, pourrait ressembler à ce qui suit:

 Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Sub Q1 () Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim wks As Worksheet Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim URL As Ssortingng Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim i As Long Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim lastRow As Long Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim theShape As Shape Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Dim pasteCell As Range Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'Feuille de travail utilisée Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Définir wks = Feuilles de travail ("Blatt1") Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'Supprimez les forms déjà existantes Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Pour chacun la forme dans wks.Shapes Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub theShape.Delete Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Suivant la forme Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'Vérifiez toutes les lignes existantes dans la colonne K Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub lastRow = Cells (Rows.Count, "K"). End (xlUp) .Row Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Pour i = 2 Pour lastRow Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'les URL sont déjà calculées et stockées dans la colonne K Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub URL = wks.Range ("K" & i) .Value Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'essayez de mettre les images dans la colonne L Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Définissez pasteCell = wks.Range ("L" & i) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub pasteCell.Select Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'Créez une forme pour mettre l'image dans Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'ActiveSheet.Pictures.Insert (URL) .Sélectionner est obsolète et ne fonctionne plus! Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub Définissez theShape = wks.Shapes.AddPicture (URL, pasteCell.Left, pasteCell.Top, 200, 200) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 'Définir la couleur arrière de l'image de forme. Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub theShape.Fill.BackColor.RGB = RGB (0, 255, 0) Sub Q1() Dim wks As Worksheet Dim URL As Ssortingng Dim i As Long Dim lastRow As Long Dim theShape As Shape Dim pasteCell As Range ' Used Worksheet Set wks = Worksheets("Blatt1") ' Delete already existing shapes For Each theShape In wks.Shapes theShape.Delete Next theShape ' Check all existing rows in Column K lastRow = Cells(Rows.Count, "K").End(xlUp).Row For i = 2 To lastRow ' the URLs are already computed and stored in column K URL = wks.Range("K" & i).Value ' try to put the images in column L Set pasteCell = wks.Range("L" & i) pasteCell.Select ' Create a Shape for putting the Image into ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!! Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200) ' Set shape image backcolor. theShape.Fill.BackColor.RGB = RGB(0, 255, 0) Next i End Sub 

Vos urls devront être correctement formatés – j'ai dû utiliser des citations sur mon URL pour l'extrait initial afin de pouvoir fonctionner efficacement, mais cela peut être une solution.

Pour Mac-Excel 2011, il existe une solution de contournement de Michael McLaughlin sur son blog. Évidemment, il n'est pas facile d'attacher des images aux cellules dans Mac-Excel 2011, voire pas du tout. En outre, la search révèle que la question de l'insertion d'images dans un classur excel a été posée plusieurs fois. Il apparaît également qu'il n'a pas été facilement résolu à travers des methods d'image jusqu'à présent dans la search. Ainsi, une solution de travail peut être la meilleure solution.

L'extrait de code, qui a été très adapté et porté sur le blog de Michael, est le suivant:

 Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Fonction InsertImageCommentAsWorkAround (titre As Ssortingng, cellAddress As Range) Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function 'Définir les variables utilisées dans le commentaire. Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Dim ImageCommentContainer Comme commentaire Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function «Effacez les commentaires existants avant d'append de nouveaux. Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Application.ActiveCell.ClearComments Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function 'Définissez le commentaire en tant que variable locale et atsortingbuez le nom du file à partir du _ Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function '_ cellAddress comme paramètre d'input pour le commentaire d'une cellule dans sa celluleAddress. Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Définir ImageCommentContainer = Application.ActiveCell.AddComment Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function 'Avec le commentaire, définissez les parameters. Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Avec ImageCommentContainer Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Texte de text: = "" Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function 'Avec la forme recouvrant le commentaire, définissez les parameters. Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function Avec .Shape Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function .Fill.UserPicture (cellAddress.Value) Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function .ScaleHeight 3 #, msoFalse, msoScaleFormTopLeft Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function InsertImageCommentAsWorkAround = titre Function InsertImageCommentAsWorkAround(title As Ssortingng, cellAddress As Range) ' Define variables used in the comment. Dim ImageCommentContainer As comment ' Clear any existing comments before adding new ones. Application.ActiveCell.ClearComments ' Define the comment as a local variable and assign the file name from the _ ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress. ' Add a comment. Set ImageCommentContainer = Application.ActiveCell.AddComment ' With the comment, set parameters. With ImageCommentContainer .Text Text:="" 'With the shape overlaying the comment, set parameters. With .Shape .Fill.UserPicture (cellAddress.Value) .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft End With End With InsertImageCommentAsWorkAround = title End Function 

Je vous conseille d'adapter les jeux de commentaires dans votre boucle et de l'utiliser pour configurer vos images en utilisant le formatting de forme de votre boucle pour définir le formatting des forms de commentaire générées par le code adapté.