Image Control Problem – Can’t LoadPicture() from URL

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on February 7, 2018



Most web services I’ve played with don’t return images themselves, they return the url address of the image. So having a robust image control that I can drop on to my spreadsheet and manipulate at run time, to load an image from a URL, is almost mandatory.

Is this currently missing from Excel, or is it a bug with the current image control, or did I just overlook something? Here’s the problem:

Inserting a picture from a url at run time is a breeze:



ActiveSheet.Pictures.Insert( _

"https://www.automateexcel.com/excel/media/msftstock.gif").Select

But who wants to just insert the image, which doesn’t have many options, I want a control, so I add an Image control from the VB toolbox called Image1 and use the standard code found on 50 or so websites:



Sheet1.Image1.Picture = LoadPicture( _

"https://www.automateexcel.com/excel/media/msftstock.gif")

ERROR!!! A 10 minute project turned into an hour and a half of researching to no avail. And to add insult to injury, F1 help for Image control, a control that’s been around 9 or so years looks like this:

advertising2

No wonder people diss on F1, the first two results are advertisements for the MS marketplace, and image control is nowhere to be found.

I did find a few hacks using api’s,sockets? and things, but that’s not acceptable. Oh well. I’ll probably see a checkbox I forgot to check in the morning LoL

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Learn More!


<<Return to VBA Examples

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples