Insert images from web to excel sheet

gledister

Board Regular
Joined
Mar 21, 2011
Messages
173
Hi guys,

Imagine we have a huge list of URLS from web like in this example:

Excel Workbook
A
1http://resources.saldiprivati.com/Sales/Mamaquevo/09032010/1_UQ20718%20NERO%202000.jpg
2http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_MARKD1021%20UK440BS0934%2034.jpg
3http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_RT%20MATHISG2319%20GE000BE9434%2034.jpg
4http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_RT%20MATHISG2319%20RW000NE9034%2034.jpg
5http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_RT%20MORGANG2122%20GE000VS7534%2034.jpg
6http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_WILSON%20AS6530%20GE000VI1834%2034.jpg
7http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Man/11032010/1_RT%20AUSTIN%20DJ9108%20RW000NE90.jpg
8http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_ERIKAD1343%20OD000DMVC34%2034.jpg
9http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MARLYND1048%20CH651BS0830%2030.jpg
10http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MEGRITD1072%20UK370BF0832%2032.jpg
11http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MENDEL%20AG2256%20WW000BI0132%2032.jpg
12http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MENDEL%20AS3220%20RW001BI0032%2032.jpg
13http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MESHD1073%20UK422BF0834%2034.jpg
14http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_MESHD1268%20UK521BS0834%2034.jpg
15http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_NATASHA%20AD1120%20UK110DMBL34%2034.jpg
16http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_NICOLED1239%20UK418BS0934%2034.jpg
17http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_ROBIND1525%20UK484BF0834%2034.jpg
18http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_RT%20EMILYD1182%20UK380DMBL.jpg
19http://resources.saldiprivati.com/Sales/Meltin%20Pot%20Woman/12032010/1_RT%20MEDORID1294%20UK420BF0930%2030.jpg
URL



What we wanna do is to insert in column B the pictures from the web.

I have this code(from Dynamic) that inserts images from a specific folder on hard drive...

Sub InsertImages()
Dim strPath As String
Dim strFile As String
Dim LastRow As Long
Dim i As Long
Dim Pic As Picture

Application.ScreenUpdating = False

strPath = "C:\Users\Domenic\Documents\Test\" 'change the path accordingly

If Right(strPath, 1) <> "\" Then strPath = strPath & "\"

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For i = 2 To LastRow
strFile = Cells(i, "A").Value & ".jpg"
If Dir(strPath & strFile) <> "" Then
Set Pic = ActiveSheet.Pictures.Insert(strPath & strFile)
With Pic
.Left = Cells(i, "B").Left
.Top = Cells(i, "B").Top
.Height = Cells(i, "B").Height
End With
Else
Cells(i, "B").Value = "N/A"
End If
Next i

Application.ScreenUpdating = True

End Sub

Any idea on how I can improve this macro code to be useful for this specific problem?!

Kind regards and thank you in advance for you precious time.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

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