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
|
Sub TestInsertPicture()
InsertPictureInRange Range("A1"), Range("D10")
End Sub
'Procédure d'insertion de l'image
Sub InsertPictureInRange(mon_texte As String, TargetCells As Range)
' inserts a picture and resizes it to fit the TargetCells range
Dim p As Object, t As Double, l As Double, w As Double, h As Double
' import picture
Dim url As String
url = "https://chart.googleapis.com/chart?cht=qr&chs=200x200&chl=" & mon_texte
Set p = ActiveSheet.Pictures.Insert(url)
With TargetCells
t = .Top
l = .Left
End With
' position picture
With p
.Top = t
.Left = l
End With
Set p = Nothing
End Sub |
Partager