Forum Discussion
Michael Lovice
Jan 04, 2019Copper Contributor
Convert image url to actual image in excel
I have a column of image URLs in my workbook and would like to show the actual image in the next column. Is there a formula or add in that can be used?
bitsol
Jan 10, 2023Copper Contributor
HI All
bellow code I'm using but not getting the actual result from goto lab line move in end
Sub URLPictureInsert()
'Updateby Extendoffice 20161116
'Update by Haytham 20180104
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("d2:d140")
For Each cell In Rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
.Width = 60
.Height = 30
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("d2").Select
Next
Application.ScreenUpdating = True
End Sub
bellow code I'm using but not getting the actual result from goto lab line move in end
Sub URLPictureInsert()
'Updateby Extendoffice 20161116
'Update by Haytham 20180104
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("d2:d140")
For Each cell In Rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
.Width = 60
.Height = 30
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("d2").Select
Next
Application.ScreenUpdating = True
End Sub