View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Get source from a web page into a worksheet

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/de...s/document.asp

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

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

wrote in message
...
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.