I've written a script in vba which uses Url
in column b
and insert the image in column c
right next to the url. The script works when I use this image link but it fails when I use this image link. How can make my script do the trick even when I use the second link?
This is my try so far:
Sub InsertImages()
Dim pics$, myPics As Shape, PicExists As Boolean, cel As Range
For Each cel In Range("C2", Range("B2").End(xlDown).Offset(0, 1))
PicExists = False
pics = cel.Offset(0, -1)
For Each myPics In ActiveSheet.Shapes
If myPics.TopLeftCell.Row = cel.Row Then PicExists = True: Exit For
Next myPics
If Not PicExists Then
With ActiveSheet.Pictures.Insert(pics)
.ShapeRange.LockAspectRatio = msoFalse
.Width = cel.Width
.Height = cel.Height
.Top = Rows(cel.Row).Top
.Left = Columns(cel.Column).Left
End With
End If
Next cel
End Sub
Post script: Although my above script can insert picture making use of the first link, the image looks quite different from the source. To be clearer: the image becomes fatty.