Importing a web page into Excel (picture)

G

Guest

Hello,

I am wondering if it is possible to pull a web picture into excel into a
specific cell?

For example, can I make the image that appears here:
http://chart.finance.yahoo.com/c/1y/f/ffiv appear in excel in a specific
cell?

I would have other data next to this picture so row 1 might have 10 other
columns and then the 11th column would be this picture.

Thanks for your help!

Rob
 
G

Guest

I am hoping to simply enter the url and have it populate. Saving to disk and
inserting it would be too time consuming.
 
T

Tim Williams

Try this:

'************************
Sub Tester()
AddPic "http://chart.finance.yahoo.com/c/1y/f/ffiv", _
ActiveSheet.Range("G10")
End Sub


Sub AddPic(URL As String, Pos As Range)

With ActiveSheet.Pictures.Insert(URL)
.Top = Pos.Top
.Left = Pos.Left
End With

End Sub
'**************************

Note that pics are not "in" cells: they can only be positioned over them.

Tim
 
R

Randy Harmelink

What I've played with in the past with my add-in (
http://finance.groups.yahoo.com/group/smf_addin/ ) is three different
approaches to attempt to automate it:

1. Have a function place the image as a "background" for a comment.
2. Insert the image but make it "exandable" to full size and
"collapsible" into the size of the cell by clicking on it
3. Using a worksheet "change" event to insert images wherever a string
of "Image: http://....." is found

For example, the simplest version of #1 would be this function
invocation:

=RCHCreateComment("http://chart.finance.yahoo.com/c/1y/f/ffiv",99)

The biggest problem with #1 is that EXCEL only allows the URL to be
less than 100 bytes long. I've had to come up with PHP workarounds
for images with longer URLs that I've wanted to use. The "99" above
indicates a "free-form" URL is being entered. If you wanted one of
the preprogrammed ones, say a chart from StockCharts, you could just
do something like:

=RCHCreateComment("MMM",1)

....where "MMM" is the ticker symbol and "1" is the choice for the
StockCharts chart.

For #2, I would simply put the URL into a worksheet cell, then run
macro RCHTogglePicture of the add-in.

The add-in is open source, so you can review how the code works. It's
in the files area of the Yahoo group, as is documentation on most of
its functions.
 
G

Guest

Tim,

Excellent!

Thanks,

Rob

Tim Williams said:
Try this:

'************************
Sub Tester()
AddPic "http://chart.finance.yahoo.com/c/1y/f/ffiv", _
ActiveSheet.Range("G10")
End Sub


Sub AddPic(URL As String, Pos As Range)

With ActiveSheet.Pictures.Insert(URL)
.Top = Pos.Top
.Left = Pos.Left
End With

End Sub
'**************************

Note that pics are not "in" cells: they can only be positioned over them.

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top