leftysgirl
09-22-2016, 07:17 AM
Run time Error 1004 - Unable to get the Picture Class..(Inserting URL images into Excel using Office 365)
Hello,
I am trying to extract from column V (Image URL link) to column W (Blank) the image from the url. Which solely is an image URL.
I have found many snippets of code using, I think what is called VBA Macros to do this function, but I am receiving a runtime error,
Unable to get the Picture Class..
Sub InstallPictures()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim url_column As Range
Dim image_column As Range
'column with url...
Set url_column = Worksheets(1).UsedRange.Columns("V")
'column where image will be inserted
Set image_column = Worksheets(1).UsedRange.Columns("W")
Dim i As Long
For i = 2 To url_column.Cells.Count
Set Picture = image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
Picture.Left = image_column.Cells(i).Left
Picture.Top = image_column.Cells(i).Top
Picture.Height = 40
image_column.Cells(i).EntireRow.RowHeight = 40
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
I believe this may be part of the issue as the debugger suggested:
Set Picture = image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
This is pretty cool stuff. I just need it to work :)
Any suggestions?
Hello,
I am trying to extract from column V (Image URL link) to column W (Blank) the image from the url. Which solely is an image URL.
I have found many snippets of code using, I think what is called VBA Macros to do this function, but I am receiving a runtime error,
Unable to get the Picture Class..
Sub InstallPictures()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim url_column As Range
Dim image_column As Range
'column with url...
Set url_column = Worksheets(1).UsedRange.Columns("V")
'column where image will be inserted
Set image_column = Worksheets(1).UsedRange.Columns("W")
Dim i As Long
For i = 2 To url_column.Cells.Count
Set Picture = image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
Picture.Left = image_column.Cells(i).Left
Picture.Top = image_column.Cells(i).Top
Picture.Height = 40
image_column.Cells(i).EntireRow.RowHeight = 40
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
I believe this may be part of the issue as the debugger suggested:
Set Picture = image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
This is pretty cool stuff. I just need it to work :)
Any suggestions?