Insert image into cell by URL macro

iindie

New Member
Joined
Sep 18, 2012
Messages
5
I am facing a bit of a challenge here ,

I would like excel to load pictures from the internet into a cell for example our item code is 2220 present into $A$1 and by macro the picture located at http://www.biesse.net/imagesmini/2220.jpg would be inserted into the next cell $A$2. I have been looking around the forums and unfortunately with partial results at this point in time .

Thanking you for your time and attention and waiting to read from you soon ,

Best Regards,
iindie
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Code:
Sub b() 
Dim cell, shp As Shape, target As Range
    myurl = "http://www.biesse.net/imagesmini/"
    Set Rng = ActiveSheet.Range("a2:a4") ' range with names
    For Each cell In Rng
       filenam = myurl & cell & ".jpg"
       ActiveSheet.Pictures.Insert(filenam).Select

      Set shp = Selection.ShapeRange.Item(1)
       With shp
          .LockAspectRatio = msoTrue
          .Width = 50
          .Height = 50
          .Cut
       End With
       Cells(cell.Row, cell.Column + 1).PasteSpecial
    Next
    
End Sub
 
Upvote 0
Everything seems fine but i get a 1004 error code telling me the insert property of class Pictures cannot be read, I am using office 2011. I guess there has been some modifications as to how office 2011 handles images.
 
Upvote 0
Code:
http://www.biesse.net/imagesmini/2220.jpg
http://www.biesse.net/imagesmini/2400.jpg
http://www.biesse.net/imagesmini/4601.jpg
http://www.biesse.net/imagesmini/4000.jpg
http://www.biesse.net/imagesmini/4001.jpg
http://www.biesse.net/imagesmini/4951.jpg
 
Upvote 0
you have to update this line

Code:
Set Rng = ActiveSheet.Range("a2:a4") ' range with names

with the used range, in your attached file a1:a5
 
Last edited:
Upvote 0
Even with the updated range it seems the problem remains the same i still get the same error message.
 
Upvote 0

Forum statistics

Threads
1,223,531
Messages
6,172,862
Members
452,485
Latest member
Savman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top