Help Creating Simple Macro to Save Images from URL

flymeoutofhere

New Member
Joined
Dec 25, 2011
Messages
10
Hi there.

I have a list of products in a list in Excel with one column containing a direct link to an image file I need to save on my pc.

I am trying to write a macro that will follow the link, and save the image to my pc named as the name of that product from the spreadsheet.

A simplified example:
PRODUCT//IMAGE
Car//http://voiture.de.reve.free.fr/BMW/BMW%20M3%20-%202002%20-%2003.jpg

etc

Thanks!
 
Using the Pictures.Insert method was a quick and dirty way. I've tried to read up on this method but there is bitterly little info on it over at MSDN. So as far as resizing goes the only way I can think is to magnify the image by increasing the size in the .ChartObjects.Add method arguments.

Unless we look at a completely different method. I can think of an alternative but it will involve a lot more coding and some Win API. I'm happy to give it a go, just not this minute. :-P

Thanks - I did try the ChartObjects.Add arguments before I replied before and it was stretching the size of the canvas but not the image itself which is weird. Why are the images shrinking?
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Thanks. In Jon's A1:A10 is the filenames to save the jpgs as and B1:B10 is the image source so it isnt working as is and I cant see how to change it around...
 
Upvote 0
Change the DownloadFiles sub to this:
Code:
Sub DownLoadFiles()
Dim cell As Range, rngListOfURL As Range

Const PTH = "C:\Some Folder\"   'this is your save to location

Set rngListOfURL = Sheet1.Range("B1:B10")   'amend as appropriate

For Each cell In rngListOfURL
    If DownloadURLtoFile(cell.Value, PTH & cell.Offset(, -1).Value & ".jpg") Then
       cell.Offset(, 1).Value = "Successfully downloaded"
    Else
        cell.Offset(, 1).Value = "Error - no download"
    End If
Next cell
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,115
Messages
6,164,012
Members
451,867
Latest member
csktwyr

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