Converting A Image URL To Actual Image in Excel

Status
Not open for further replies.

RyGUY1446

New Member
Joined
Apr 11, 2013
Messages
1
How can I convert a Image URL in excel to an actual image? I'm looking to take a url in column A and show the image in column B but also only have the image be certain size?

I've tried this but kept getting an error.

"Dim url_column As Range
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">Dim image_column As RangeSet url_column = Worksheets(1).UsedRange.Columns("A")Set image_column = Worksheets(1).UsedRange.Columns("B")Dim i As LongFor 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 WithNext"</code></pre>
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this:
Code:
Sub InsImg()

    Dim URL As Range
        
    For Each URL In Range("A1", Cells(Rows.Count, "A").End(xlUp))
        With URL.Parent.Pictures.Insert(URL.Value)
            .Left = URL.Offset(0, 1).Left
            .Top = URL.Offset(0, 1).Top
            URL.EntireRow.RowHeight = .Height
        End With
    Next

End Sub
If you got an error with your code, it helps if you tell us exactly what the error is and on which line it occurs.

Also, please put code within [ CODE] and [ /CODE] tags (without the spaces).
 
Upvote 0
I have images that are several different sizes. I used this code to see if it would extract the image in the next cell without changing the size of the image. It worked for some of the images but then errored out.

1684787484951.png

1684787461568.png
 
Upvote 0
HI
I think the suggestion for this line of code
For Each URL In Range("D2:D712", Cells(Rows.Count, "D").End(xlUp))
it must be changed so
VBA Code:
For Each URL In Range("D2", Cells(Rows.Count, "D").End(xlUp))
HI,
Mario
 
Upvote 0
HI
I think the suggestion for this line of code
For Each URL In Range("D2:D712", Cells(Rows.Count, "D").End(xlUp))
it must be changed so
VBA Code:
For Each URL In Range("D2", Cells(Rows.Count, "D").End(xlUp))
HI,
Mario
I am still getting the same error after making that change.
1684788325169.png
 
Upvote 0
Duplicate to: Converting a Image URL to Actual Image Size

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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