Get source from a web page into a worksheet

G

Guest

I have often written macros that import data from a web page into a
worksheet. Now I need to get the source code from the web page into the
worksheet. (The source is what you get when, in Internet Explorer, you
right click on a page and selece "view source".)

Is there any way I can do this?

Many thanks for any help.
 
D

Dick Kusleika

NS

Here's a sub that will get the HTML between the body tags.

Sub GetSource()

Dim ieApp As InternetExplorer

Set ieApp = New InternetExplorer

ieApp.Navigate "http:\\www.dicks-clicks.com"
Do
Loop Until ieApp.ReadyState = READYSTATE_COMPLETE

Debug.Print ieApp.Document.body.innerhtml

End Sub

That won't be everything you get when you View Source, but it's a start.
Check here

http://msdn.microsoft.com/library/d.../webbrowser/reference/properties/document.asp

for documentation on the Document object and maybe you can find something to
get what you want.
 

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