How to get image from web

M

Milos Setek

Hi all,

Is there a way to use web query in Excel to save image from a web site into
spreadsheet?

Thanks for any tips

Milos.
 
N

Nicky

Hi Milos

Not sure if this is what you're after, but I use this macro o
variations on it to copy info from websites.

It can be pictures, text, CSV or excel files - any info that you wan
that excel can read. it is useful if you regularly get data from th
same same site, and where you know the names of the files you want t
copy.

The file path is specified, then an array containing the names of th
pictures, files etc you want to copy. The macro combines the two t
identify what to copy. Each picture is copied to a new sheet.

This version copies cartoons from the website of Private Eye magazine
Change the address and contents to suit your needs.

Sub download_cartoons()

file_path = "http://www.private-eye.co.uk/images/cartoons/"
file_names = Array("1.gif", "2.gif", "3.gif", "4.gif", "5.gif"
"6.gif", "7.gif", "8.gif", "9.gif", "10.gif", "11.gif", "12.gif"
"13.gif", "14.gif", "15.gif", "16.gif", "17.gif", "18.gif", "19.gif"
"20.gif", "21.gif", "22.gif", "23.gif", "24.gif", "25.gif", "26.gif"
"27.gif", "28.gif", "29.gif", "30.gif", "31.gif", "32.gif", "33.gif"
"34.gif", "35.gif", "36.gif", "37.gif", "38.gif", "39.gif", "40.gif"
"41.gif", "42.gif", "43.gif", "44.gif", "45.gif", "46.gif", "47.gif"
"48.gif", "49.gif", "50.gif")
For n = LBound(file_names) To UBound(file_names)
to_copy = file_path & file_names(n)

On Error Resume Next
ActiveSheet.Pictures.Insert(to_copy).Select
If Error = "" Then Sheets.Add after:=Worksheets(Worksheets.Count)

Next
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top