ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get source from a web page into a worksheet (https://www.excelbanter.com/excel-programming/305449-get-source-web-page-into-worksheet.html)

[email protected]

Get source from a web page into a worksheet
 
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.

Dick Kusleika[_3_]

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.





All times are GMT +1. The time now is 04:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com