none
Run Time Error '1004' - Unable to get the Insert Property of the Pictures Class RRS feed

  • Question

  • Hi i've been tying to use the code below in Excel to insert a picture into an adjacent cell from a URL

    However upon running, the title of this thread error message is returned

    The images are of drawings of manufactured parts stored on my company's intranet

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim url_column As Range
    Dim image_column As Range
    
    Set url_column = Worksheets(1).UsedRange.Columns("H")
    Set image_column = Worksheets(1).UsedRange.Columns("I")
    
    Dim i As Long
    For i = 1 To url_column.Cells.Count
      With image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
        .Left = image_column.Cells(i).Left
        .Top = image_column.Cells(i).Top
        image_column.Cells(i).EntireRow.RowHeight = .Height
      End With
    
    Next
    End Sub

    Does anyone have any idea why it is failing?


    • Edited by Owen_legend Wednesday, June 17, 2015 1:26 PM
    Wednesday, June 17, 2015 1:25 PM

All replies

  • ActiveWorkbook.Sheets("Plan1").Range("K10").Select
    ActiveWorkbook.Sheets("Plan1").Pictures.Insert ("C:\Users\andreses\Desktop\sala.jpg")
    Try to select the range first and then insert the picture
    Wednesday, June 17, 2015 2:18 PM
  • Could you elaborate in reference to the code I have used?

    Also I wish for the picture to be resized to the size of the cell

    Wednesday, June 17, 2015 3:37 PM