title: Inserting an Online Picture to Excel with VBA
body: <p>I'm currently working on a project and need to fill in cells with pictures via URLs. All URLs are in one column, and I'd like to load the images in an adjacent column. I'm no VBA expert, but I found some code that worked, but for some reason I get an error (usually 5 images in) that says:</p>
  
  <p>Run-time error '1004':
  Unable to get the Insert property of the Pictures Class </p>
  
  <p>Again, I'm using a system where URLs are in one column i.e.:</p>
  
  <p>xxxx.com/xxxx1.jpg</p>
  
  <p>xxxx.com/xxxx2.jpg</p>
  
  <p>xxxx.com/xxxx3.jpg</p>
  
  <p>xxxx.com/xxxx4.jpg</p>
  
  <p>Through some searching, I found that it could be linked to my Excel version (using 2010), though I'm not completely sure.</p>
  
  <p>Here's the current code I'm using:</p>
  
  <pre><code>Sub URLPictureInsert()
  Dim cell, shp As Shape, target As Range
      Set Rng = ActiveSheet.Range("a5:a50") ' range with URLs
      For Each cell In Rng
         filenam = cell
         ActiveSheet.Pictures.Insert(filenam).Select
  
    Set shp = Selection.ShapeRange.Item(1)
     With shp
        .LockAspectRatio = msoTrue
        .Width = 100
        .Height = 100
        .Cut
     End With
     Cells(cell.Row, cell.Column + 1).PasteSpecial
  Next
  
  End Sub
  </code></pre>
  
  <p>Any help would be much appreciated!</p>
  
  <p>Original code source: <a href="http://www.mrexcel.com/forum/excel-questions/659968-insert-image-into-cell-url-macro.html" rel="noreferrer">http://www.mrexcel.com/forum/excel-questions/659968-insert-image-into-cell-url-macro.html</a></p>