Displaying a GIF from a URL in Excel

J

Jim Goodwin

Point your browser at http://ichart.yahoo.com/t?s=AMR
You'll get a nice little 1 by 2 inch stock chart for AMR.
The chart is actually a GIF.

I want to set up a cell or cells in a spreadsheet so they
fetch this chart from the web and display it.

I've tried to make a Web Query do this. I fail, because it
displays only a little gibberish, presumably because it does
not understand that the URL result data is a GIF to be shown
graphically.

As far as I can tell, Web Queries are just not intended to do this.
They are intended to scrape tabular data from URL's, not graphics.
Is this correct? Is there any workaround? Is there some other
approach in Excel that is more appropriate?


Thanks

JG
 
J

Jake Marx

Hi Jim,

You're right - I don't think you can do this with a web query. But you can
do it with a few lines of VBA code:

Application.Goto Sheet1.Range("C10")
Sheet1.Pictures.Insert http://ichart.yahoo.com/t?s=AMR

[BTW, I figured this out by recording a macro, selecting Insert |
Picture --> From File, then entering the URL in the file name box.]

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
B

Bill Sharpe

Hi Jim,

You're right - I don't think you can do this with a web query. But you
can
do it with a few lines of VBA code:

Application.Goto Sheet1.Range("C10")
Sheet1.Pictures.Insert http://ichart.yahoo.com/t?s=AMR

[BTW, I figured this out by recording a macro, selecting Insert |
Picture --> From File, then entering the URL in the file name box.]

I got an error using the above code. Changing the second line as follows
worked nicely in Excel 2002:

ActiveSheet.Pictures.Insert("http://ichart.yahoo.com/t?s=AMR").Select

Bill
 
J

Jake Marx

Hi Bill,

Bill said:
I got an error using the above code. Changing the second line as
follows worked nicely in Excel 2002:

ActiveSheet.Pictures.Insert("http://ichart.yahoo.com/t?s=AMR").Select

You shouldn't need the Select method. My post was supposed to have double
quotes around the URL, but I think OE stripped them off when I composed the
message. So I'll try using spaces to see if I can get OE to ignore the
quotes.

ActiveSheet.Pictures.Insert " http://ichart.yahoo.com/t?s=AMR "

This should work as expected.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
J

Jim Goodwin

Gentlemen,

I finally got back to working on this and the final suggestion above worked
fine in Excel 2000. Thank you so much!

jwg
 
Top