I have a list of urls in column A.
I would like to use those urls to fetch the corresponding image and save it to a directory, and keep the size of the original image as is on the site.
the code I currently have is importing the image into column B, right next to its url.
I'd like to have the image saved as the item number that would be in column C.
Ive seen this done before but some of the example code is very outdated and will not work on my pc..
windows 10, excel 2016.
the item number that would be in column C is the 6 digit code after /300x300.
here are the urls that I am attempting to retrieve the images from. the size of the image is 300x300.
[TABLE="width: 455"]
<tbody>[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/125716.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/121881.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/119866.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/128244.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/218368.jpg[/TD]
[/TR]
</tbody>[/TABLE]
here is the code that i am using to import the images into excel.
is this still possible?
I would like to use those urls to fetch the corresponding image and save it to a directory, and keep the size of the original image as is on the site.
the code I currently have is importing the image into column B, right next to its url.
I'd like to have the image saved as the item number that would be in column C.
Ive seen this done before but some of the example code is very outdated and will not work on my pc..
windows 10, excel 2016.
the item number that would be in column C is the 6 digit code after /300x300.
here are the urls that I am attempting to retrieve the images from. the size of the image is 300x300.
[TABLE="width: 455"]
<tbody>[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/125716.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/121881.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/119866.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/128244.jpg[/TD]
[/TR]
[TR]
[TD]https://www.fragrancenet.com/images/photos/300x300/218368.jpg[/TD]
[/TR]
</tbody>[/TABLE]
here is the code that i am using to import the images into excel.
Code:
'use url in column A to fetch the image to column b
Sub URLPictureInsert()
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("A1:A175")
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
If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("A2").Select
Next
Application.ScreenUpdating = True
End Sub
is this still possible?
Last edited: