Copy Picture from Web to Excel
The following code pastes the picture from Web to the Excel range. The two parameters required by the function are the URL of the picture and address of target Excel range. The function Test at the bottom is given as an example.
To get the url of the picture right click the picture and in the properties copy the Address (URL) if you are using Internet Explorer; right click and copy image url in Google Chrome; right click and copy image location in Firefox.
Sub GetShapeFromWeb(strShpUrl As String, rngTarget As Range) Dim shp As Shape With rngTarget With .Parent .Pictures.Insert strShpUrl Set shp = .Shapes(.Shapes.Count) End With shp.Left = .Left shp.Top = .Top End With Set shp = Nothing End Sub Sub Test() Call GetShapeFromWeb("http://excelexperts.com/sites/default/files/logo.jpg", Sheet1.Range("F3")) End Sub
»
- Vishesh's blog
- Login or register to post comments
- 42665 reads
A shorter code...
Is there a way to bulk insert images ?
This is great vba,but i would like to know if i can bulk insert them and allign them to a cell.
So i have an excel with many url of web images,is there a way i can bulk insert them each on every line centered with a row height of about 90 px and an image height of 80 px with aspect ratio?
So say it goes like that
COLUMN A | COLUMN B
IMAGE 1 | URL 1
IMAGE 2 | URL 2
ETC.
if this isn't possible it may also would be nice to have them inserted as comment as fill format picture!
Thanks in advance
This is very much possible.
This is very much possible. You can run a loop on the cell range where you have your images' urls. From within the loop you can call the above function with the required parameters - the image url and the target cell.
Once the shape is there in Excel you can set its dimension.
image url auto refresh
Dear Vishesh,
your site was very helpful for me.....i would like some help form you....i do want a image url to excel with auto refresh every 10seconds. i would be placing a button for on & off to refresh new image in to excel. when its in ON it auto refresh every 10seconds.
http://excelexperts.com/copy-picture-web-excel ...link helped me a lot...but i do want autorefresh the image.
Regards,
Raju
Is the image on the url
Is the image on the url changing after sometime ? If not then whats the use of refreshing the the image.
image url auto refresh
Dear Vishesh,
your site was very helpful for me.....i would like some help form you....i do want a image url to excel with auto refresh every 10seconds. i would be placing a button for on & off to refresh new image in to excel. when its in ON it auto refresh every 10seconds.
http://excelexperts.com/copy-picture-web-excel ...link helped me a lot...but i do want autorefresh the image.
Regards,
Raju
image url auto refresh
Dear Vishesh,
your site was very helpful for me.....i would like some help form you....i do want a image url to excel with auto refresh every 10seconds. i would be placing a button for on & off to refresh new image in to excel. when its in ON it auto refresh every 10seconds.
http://excelexperts.com/copy-picture-web-excel ...link helped me a lot...but i do want autorefresh the image.
Regards,
Raju
image url auto refresh
Dear Vishesh,
your site was very helpful for me.....i would like some help form you....i do want a image url to excel with auto refresh every 10seconds. i would be placing a button for on & off to refresh new image in to excel. when its in ON it auto refresh every 10seconds.
http://excelexperts.com/copy-picture-web-excel ...link helped me a lot...but i do want autorefresh the image.
Regards,
Raju
image url auto refresh
Dear Vishesh,
your site was very helpful for me.....i would like some help form you....i do want a image url to excel with auto refresh every 10seconds. i would be placing a button for on & off to refresh new image in to excel. when its in ON it auto refresh every 10seconds.
http://excelexperts.com/copy-picture-web-excel ...link helped me a lot...but i do want autorefresh the image.
Regards,
Raju