WebBrowser -> Image on Sheet

C

Cheer

I wold like to display an image from a web page on an Excel sheet. I
can't just put an image control on the sheet and have it point to the
URL for the image (e.g.,
http://bigcharts.marketwatch.com/quickchart/quickchart.asp?symb=IBM&sid=0&o_symb=IBM)
because that doesn't work. A WebQuery doesn't just capture the image,
so that doesn't work either.

A WebBrowser control on a UserForm will work, but how do I get the
image of the chart from the WebBrowser to the sheet? I really don't
want to have to put a WebBrowser control on a Worksheet.

Here's an interesting thing, though: If you DO put a WebBrowser
control on your sheet, you can then click and drag from the WebBrowser
to another location on the sheet and Excel will paste an *image* of
what's on the WebBrowser onto your sheet! This is what I want! But
"record macro" won't pick it up and I can't really tell what Excel is
doing in that case. (At least this used to work before I installed
QuickTime - but that's another problem, apparently)

Thanks in advance for any help.
 
C

Cheer

I wold like to display an image from a web page on an Excel sheet. I
can't just put an image control on the sheet and have it point to the
URL for the image (e.g.,
http://bigcharts.marketwatch.com/quickchart/quickchart.asp?symb=IBM&sid=0&o_symb=IBM)
because that doesn't work. A WebQuery doesn't just capture the image,
so that doesn't work either.

A WebBrowser control on a UserForm will work, but how do I get the
image of the chart from the WebBrowser to the sheet? I really don't
want to have to put a WebBrowser control on a Worksheet.

Here's an interesting thing, though: If you DO put a WebBrowser
control on your sheet, you can then click and drag from the WebBrowser
to another location on the sheet and Excel will paste an *image* of
what's on the WebBrowser onto your sheet! This is what I want! But
"record macro" won't pick it up and I can't really tell what Excel is
doing in that case. (At least this used to work before I installed
QuickTime - but that's another problem, apparently)

Thanks in advance for any help.

Well, I'll answer my own post since no one else seems up to it. :p

Courtesy of xlDennis:

Option Explicit

Sub Picture_Web()
Dim wsSheet As Worksheet
Dim rnPicture As Range
Dim stFile As String

Set wsSheet = ThisWorkbook.Worksheets(1)
stFile = "http://www.xxxx.com/xxx.gif"

With wsSheet
Set rnPicture = .Range("A2")
End With

rnPicture.Select
wsSheet.Pictures.Insert(stFile).Select

End Sub
 

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